﻿using GameFramework;
using GameFramework.Enum;
using M2Server.Mon;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;

namespace M2Server
{
    public class TPlayObject : TAnimalObject
    {
        #region 变量区
        /// <summary>
        /// 野蛮冲撞间隔
        /// </summary>
        public uint m_dwDoMotaeboTick = 0;
        /// <summary>
        /// 人物死亡地图
        /// </summary>
        public string m_sLastMapName;
        /// <summary>
        /// 人物死亡地图所在座标X(4字节)
        /// </summary>
        public int m_nLastCurrX = 0;
        /// <summary>
        /// 人物死亡地图所在座标Y(4字节)
        /// </summary>
        public int m_nLastCurrY = 0;
        /// <summary>
        /// 发言次数
        /// </summary>
        public int m_nSayMsgCount = 0;
        /// <summary>
        /// 发言间隔
        /// </summary>
        public uint m_dwSayMsgTick = 0;
        public bool m_boDisableSayMsg = false;
        public uint m_dwDisableSayMsgTick = 0;
        public uint m_dwCheckDupObjTick = 0;
        public uint dwTick578 = 0;
        public uint dwTick57C = 0;
        public bool m_boInSafeArea = false;
        /// <summary>
        /// 登录帐号名
        /// </summary>
        public string m_sUserID;
        /// <summary>
        /// 人物IP地址
        /// </summary>
        public string m_sIPaddr;
        public string m_sIPLocal = string.Empty;// IP所属地区
        public byte m_btDeputyHeroJob = 0; // 双英雄变量
        public bool m_boHasDeputyHero = false;// 是否有主副将英雄
        public string m_sDeputyHeroCharName;// 副将英雄名称
        public uint m_nRecallDeputyHeroTime = 0;// 召唤副将英雄间隔时间
        public string m_sAssessHeroMsg = string.Empty;// 主副将英雄信息
        public TAssessHeroDataInfo[] AssessHeroDataInfo = new TAssessHeroDataInfo[1];
        public string sName1 = String.Empty;
        public string sName2 = String.Empty;
        public bool m_boHeroAutoTraining = false;// 副将英雄是否正在自动修炼
        public object m_nUserCmdNPC = null;
        public DateTime m_dLogonTime;// 登录时间
        public uint m_dwLogonTick = 0;// 在线时长
        /// <summary>
        /// 是否进入游戏完成
        /// </summary>
        public bool m_boReadyRun = false;
        /// <summary>
        /// 会话ID
        /// </summary>
        public int m_nSessionID = 0;
        /// <summary>
        /// 人物当前模式(测试/付费模式)
        /// </summary>
        public int m_nPayMent = 0;
        /// <summary>
        /// 付费模式
        /// </summary>
        public int m_nPayMode = 0;
        /// <summary>
        /// 人物当前所在服务器序号
        /// </summary>
        public int m_nServerIndex = 0;
        /// <summary>
        /// 掉线标志
        /// </summary>
        public bool m_boEmergencyClose = false;
        /// <summary>
        /// 小退
        /// </summary>
        public bool m_boSoftClose = false;
        /// <summary>
        /// 踢人下线,断线标志(@kick 命令)
        /// </summary>
        public bool m_boKickFlag = false;
        /// <summary>
        /// 重新连接标志
        /// </summary>
        public bool m_boReconnection = false;
        /// <summary>
        /// 是否正在保存数据
        /// </summary>
        public bool m_boRcdSaveding = false;
        /// <summary>
        /// 是否保存数据
        /// </summary>
        public bool m_boRcdSaved = false;
        public bool m_boSwitchData = false;
        /// <summary>
        /// 写入数据库错误次数
        /// </summary>
        public int m_nWriteChgDataErrCount = 0;
        /// <summary>
        /// 切换目标地图名称
        /// </summary>
        public string m_sSwitchMapName = string.Empty;
        public int m_nSwitchMapX = 0;
        public int m_nSwitchMapY = 0;
        public bool m_boSwitchDataSended = false;
        public uint m_dwChgDataWritedTick = 0;
        public int m_nSocket = 0;
        /// <summary>
        /// 人物连接到游戏网关SOCKET ID
        /// </summary>
        public int m_nGSocketIdx = 0;
        /// <summary>
        /// 人物所在网关号
        /// </summary>
        public int m_nGateIdx = 0;
        /// <summary>
        /// 版本日期
        /// </summary>
        public int m_nSoftVersionDate = 0;
        /// <summary>
        /// 脚本标签
        /// </summary>
        public string m_sScriptLable = string.Empty;
        /// <summary>
        /// 由功能插件调用 0-倒计时触发QF段(客户端显示时间) 1-商铺购买间隔 2-倒计时触发QF段 3-定时发时间给客户端，保持统一
        /// </summary>
        public uint[] m_dwUserTick = new uint[3];
        /// <summary>
        /// SENDTIMEMSG命令设置的触发段
        /// </summary>
        public string m_sMapQFStr = string.Empty;
        /// <summary>
        /// SENDMSGWINDOWS命令设置的触发段
        /// </summary>
        public string m_sMapQFStr1 = string.Empty;
        /// <summary>
        /// 换地图是否还显示倒计时信息
        /// </summary>
        public bool m_boForMapShowHint = false;
        /// <summary>
        /// 是否显示天地结晶图标
        /// </summary>
        public bool m_boShowExpCrystal = false;
        /// <summary>
        /// 天地结晶等级
        /// </summary>
        public byte m_CrystalLevel = 0;
        /// <summary>
        /// 天地结晶当前经验
        /// </summary>
        public UInt32 m_CrystalExp = 0;
        /// <summary>
        /// 天地结晶升级经验
        /// </summary>
        public uint m_CrystalMaxExp = 0;
        /// <summary>
        /// 天地结晶当前内功经验
        /// </summary>
        public UInt32 m_CrystalNGExp = 0;
        /// <summary>
        /// 天地结晶内功升级经验
        /// </summary>
        public uint m_CrystalNGMaxExp = 0;
        /// <summary>
        /// 是否可以提取经验
        /// </summary>
        public bool m_boGetExpCrystalExp = false;
        /// <summary>
        /// 可提取天地结晶经验
        /// </summary>
        public uint m_nGetCrystalExp = 0;
        /// <summary>
        /// 天可提取地结晶内功经验
        /// </summary>
        public uint m_nGetCrystalNGExp = 0;
        public uint m_dwSayMyInfoTick = 0;
        /// <summary>
        /// 正在购买商铺物品中
        /// </summary>
        public bool m_boBuyShopItem = false;
        /// <summary>
        /// 正在交易中
        /// </summary>
        public bool m_boDealing = false;
        /// <summary>
        /// 交易最后操作时间
        /// </summary>
        public uint m_DealLastTick = 0;
        /// <summary>
        /// 交易的主动方
        /// </summary>
        public TPlayObject m_DealCreat = null;
        /// <summary>
        /// 组队队长
        /// </summary>
        public TPlayObject m_GroupOwner = null;
        /// <summary>
        /// 组成员列表
        /// </summary>
        public List<TPlayObject> m_GroupMembers = null;
        /// <summary>
        /// 允许私聊
        /// </summary>
        public bool m_boHearWhisper = false;
        /// <summary>
        /// 允许群聊
        /// </summary>
        public bool m_boBanShout = false;
        /// <summary>
        /// 允许接收所有喊话
        /// </summary>
        public bool m_boBanGmMsg = false;
        /// <summary>
        /// 拒绝行会聊天
        /// </summary>
        public bool m_boBanGuildChat = false;
        /// <summary>
        /// 是不允许交易
        /// </summary>
        public bool m_boAllowDeal = false;
        /// <summary>
        /// 禁止私聊人员列表
        /// </summary>
        public List<string> m_BlockWhisperList = null;
        /// <summary>
        /// 饥饿状态----注释父类变量 
        /// </summary>
        public int m_nHungerStatus = 0;
        /// <summary>
        /// 行会合一
        /// </summary>
        public bool m_boAllowGuildReCall = false;
        /// <summary>
        /// 队传送时间
        /// </summary>
        public uint m_wGroupRcallTime = 0;
        public bool m_boAllowGroupReCall = false;
        /// <summary>
        /// 确认元宝寄售标志
        /// </summary>
        public bool m_boSellOffOK = false;
        /// <summary>
        /// 元宝寄售物品列表
        /// </summary>
        public List<IntPtr> m_SellOffItemList = null;
        /// <summary>
        /// 粹练物品列表
        /// </summary>
        public List<IntPtr> m_RefineItemList = null;
        /// <summary>
        /// 交易物品列表
        /// </summary>
        public List<IntPtr> m_DealItemList = null;
        /// <summary>
        /// 交易的金币数量
        /// </summary>
        public int m_nDealGolds = 0;
        /// <summary>
        /// 确认交易标志(Byte)  确认元宝寄售标志
        /// </summary>
        public bool m_boDealOK = false;
        /// <summary>
        /// 允许组队
        /// </summary>
        public bool m_boAllowGroup = false;
        /// <summary>
        /// 允许加入行会
        /// </summary>
        public bool m_boAllowGuild = false;
        /// <summary>
        /// 喊消息间隔
        /// </summary>
        public uint m_dwShoutMsgTick = 0;
        /// <summary>
        /// 仓库
        /// </summary>
        public List<IntPtr> m_StorageItemList = null;
        /// <summary>
        /// 魔法间隔
        /// </summary>
        public uint m_dwMagicHitIntervalTime = 0;
        /// <summary>
        /// 跑步间隔
        /// </summary>
        public uint m_dwRunIntervalTime = 0;
        /// <summary>
        /// 走路间隔
        /// </summary>
        public uint m_dwWalkIntervalTime = 0;
        /// <summary>
        /// 换方向间隔
        /// </summary>
        public uint m_dwTurnIntervalTime = 0;
        /// <summary>
        /// 组合操作间隔
        /// </summary>
        public uint m_dwActionIntervalTime = 0;
        /// <summary>
        /// 移动刺杀间隔
        /// </summary>
        public uint m_dwRunLongHitIntervalTime = 0;
        /// <summary>
        /// 跑位攻击间隔
        /// </summary>
        public uint m_dwRunHitIntervalTime = 0;
        /// <summary>
        /// 走位攻击间隔
        /// </summary>
        public uint m_dwWalkHitIntervalTime = 0;
        /// <summary>
        /// 跑位魔法间隔
        /// </summary>
        public uint m_dwRunMagicIntervalTime = 0;
        /// <summary>
        /// 魔法攻击时间
        /// </summary>
        public uint m_dwMagicAttackTick = 0;
        /// <summary>
        /// 魔法攻击间隔时间
        /// </summary>
        public uint m_dwMagicAttackInterval = 0;
        /// <summary>
        /// 攻击时间
        /// </summary>
        public uint m_dwAttackTick = 0;
        /// <summary>
        /// 人物跑动时间
        /// </summary>
        public uint m_dwMoveTick = 0;
        /// <summary>
        /// 人物攻击计数
        /// </summary>
        public uint m_dwAttackCount = 0;
        /// <summary>
        /// 人物攻击计数
        /// </summary>
        public uint m_dwAttackCountA = 0;
        /// <summary>
        /// 魔法攻击计数
        /// </summary>
        public uint m_dwMagicAttackCount = 0;
        /// <summary>
        /// 人物跑计数
        /// </summary>
        public uint m_dwMoveCount = 0;
        /// <summary>
        /// 人物跑计数
        /// </summary>
        public uint m_dwMoveCountA = 0;
        /// <summary>
        /// 超速计数
        /// </summary>
        public int m_nOverSpeedCount = 0;
        public bool m_boDieInFight3Zone = false;
        public TScript m_Script = null;
        public TBaseObject m_NPC = null;
        /// <summary>
        /// 玩家的变量
        /// </summary>
        public int[] m_nVal = new int[99];
        /// <summary>
        /// 玩家的变量
        /// </summary>
        public int[] m_nMval = new int[99];
        /// <summary>
        /// 玩家的变量
        /// </summary>
        public int[] m_DyVal = new int[99];
        public string m_sPlayDiceLabel = string.Empty;
        public bool m_boTimeRecall = false;
        public uint m_dwTimeRecallTick = 0;
        public string m_sMoveMap = string.Empty;
        public int m_nMoveX = 0;
        public int m_nMoveY = 0;
        /// <summary>
        /// 保存人物数据时间间隔
        /// </summary>
        public uint m_dwSaveRcdTick = 0;
        public int m_nBright = 0;
        /// <summary>
        /// 新人物
        /// </summary>
        public bool m_boNewHuman = false;
        public bool m_boSendNotice = false;
        public uint m_dwWaitLoginNoticeOKTick = 0;
        /// <summary>
        /// 在游戏公告上点了确定
        /// </summary>
        public bool m_boLoginNoticeOK = false;
        public bool bo6AB = false;
        /// <summary>
        /// 帐号过期
        /// </summary>
        public bool m_boExpire = false;
        public uint m_dwShowLineNoticeTick = 0;
        /// <summary>
        /// 当前显示公告索引
        /// </summary>
        public int m_nShowLineNoticeIdx = 0;
        /// <summary>
        /// 客户端版本日期
        /// </summary>
        public int m_nSoftVersionDateEx = 0;
        /// <summary>
        /// 能跳转脚本标签列表
        /// </summary>
        public List<string> m_CanJmpScriptLableList = null;
        /// <summary>
        /// 脚本跳转GOTO数
        /// </summary>
        public int m_nScriptGotoCount = 0;
        public string m_sScriptCurrLable = string.Empty;// 用于处理 @back 脚本命令
        public string m_sScriptGoBackLable = string.Empty;// 用于处理 @back 脚本命令
        /// <summary>
        /// 转向间隔
        /// </summary>
        public uint m_dwTurnTick = 0;
        /// <summary>
        /// 旧的动作消息
        /// </summary>
        public ushort m_wOldIdent = 0;
        /// <summary>
        /// 旧的方向
        /// </summary>
        public byte m_btOldDir = 0;
        /// <summary>
        /// 二次操作之间间隔时间
        /// </summary>
        public uint m_dwActionTick = 0;
        /// <summary>
        /// 配偶名称
        /// </summary>
        public string m_sDearName;
        public TPlayObject m_DearHuman = null;// 配偶类
        public bool m_boCanDearRecall = false;// 是否允许夫妻传送
        public bool m_boCanMasterRecall = false;// 是否允许师徒传送
        public uint m_dwDearRecallTick = 0;// 夫妻传送间隔
        public uint m_dwMasterRecallTick = 0;// 师徒传送间隔
        /// <summary>
        /// 师傅名称
        /// </summary>
        public string m_sMasterName;
        public TPlayObject m_MasterHuman = null;
        public List<TPlayObject> m_MasterList = null;// 徒弟列表
        /// <summary>
        /// 是否是徒弟  T-有徒弟
        /// </summary>
        public bool m_boMaster = false;
        public ushort m_nMasterNo = 0;// 徒弟排名
        public List<string> m_MasterNoList = null;// 徒弟排名列表
        public int m_btCreditPoint = 0;// 声望点
        public byte m_btMarryCount = 0;// 离婚次数
        public byte m_btReLevel = 0;// 转生等级
        public byte m_btReColorIdx = 0;
        public uint m_dwReColorTick = 0;
        /// <summary>
        /// 处理消息循环时间控制
        /// </summary>
        public uint m_dwGetMsgTick = 0;
        /// <summary>
        /// 设置仓库密码
        /// </summary>
        public bool m_boSetStoragePwd = false;
        public bool m_boReConfigPwd = false;
        public bool m_boCheckOldPwd = false;// 是否检查旧密码
        public bool m_boUnLockPwd = false;// 解锁定
        /// <summary>
        /// 锁定仓仓库密码
        /// </summary>
        public bool m_boUnLockStoragePwd = false;
        /// <summary>
        /// 锁密码
        /// </summary>
        public bool m_boPasswordLocked = false;
        public byte m_btPwdFailCount = 0;
        /// <summary>
        /// 是否启用锁登录功能
        /// </summary>
        public bool m_boLockLogon = false;
        public bool m_boLockLogoned = false;// 是否打开登录锁(解)
        public string m_sTempPwd;// 临时密码
        /// <summary>
        /// 仓库密码
        /// </summary>
        public string m_sStoragePwd;
        /// <summary>
        /// 面对面的角色
        /// </summary>
        public TBaseObject m_PoseBaseObject = null;
        public bool m_boStartMarry = false;
        public bool m_boStartMaster = false;// 开始收徒或拜师
        public bool m_boStartUnMarry = false;
        public bool m_boStartUnMaster = false;// 开始出师
        public bool m_boFilterSendMsg = false;// 禁止发方字(发的文字只能自己看到)
        public int m_nKillMonExpRate = 0;// 杀怪经验倍数(此数除以 100 为真正倍数)
        public int m_nOldKillMonExpRate = 0;// 没使用套装前杀怪经验倍数 
        public int m_nItmeIncMonExpRate = 0;// 使用套装增加的经验 
        public int m_nPowerRate = 0;// 人物攻击力倍数(此数除以 100 为真正倍数)
        public uint m_dwPowerRateTime = 0;// 人物攻击力倍数改变恢复正常的时间计数(秒)
        public UInt16 m_dwKillMonExpRateTime = 0;// 调整杀怪经验倍数后的使用时间(秒)
        public uint m_dwRateTick = 0;
        public bool m_boCanUseItem = false;// 是否允许使用物品
        /// <summary>
        /// 能交易
        /// </summary>
        public bool m_boCanDeal = false;
        /// <summary>
        /// 能扔
        /// </summary>
        public bool m_boCanDrop = false;
        public bool m_boCanGetBackItem = false;// 取回升级的物品
        public bool m_boCanWalk = false;// 是否能走
        public bool m_boCanRun = false;// 是否允许跑
        public bool m_boCanHit = false;// 是否允许打击
        public bool m_boCanSpell = false;// 是否允许魔法
        public bool m_boCanSendMsg = false;// 是否允许发送信息
        public int m_nMemberType = 0;// 会员类型
        public int m_nMemberLevel = 0;// 会员等级
        /// <summary>
        /// 发祝福语标志
        /// </summary>
        public bool m_boSendMsgFlag = false;
        public bool m_boChangeItemNameFlag = false;
        /// <summary>
        /// 金刚石数量
        /// </summary>
        public int m_nGAMEDIAMOND = 0;
        /// <summary>
        /// 灵符数量
        /// </summary>
        public int m_nGAMEGIRD = 0;
        /// <summary>
        /// 荣誉
        /// </summary>
        public byte m_btGameGlory = 0;
        /// <summary>
        /// 游戏币(元宝)
        /// </summary>
        public int m_nGameGold = 0;
        public bool m_boDecGameGold = false;// 是否自动减游戏币
        public uint m_dwDecGameGoldTime = 0;// 自动减游戏币时间
        public uint m_dwDecGameGoldTick = 0;// 自动减游戏币间隔
        public int m_nDecGameGold = 0;// 一次减点数
        public bool m_boIncGameGold = false;// 是否自动加游戏币
        public uint m_dwIncGameGoldTime = 0;// 自动加游戏时间
        public uint m_dwIncGameGoldTick = 0;// 自动加游戏间隔
        public int m_nIncGameGold = 0;// 一次减点数
        public UInt16 m_nGamePoint = 0;// 游戏点数
        public uint m_dwIncGamePointTick = 0;// 加游戏点的间隔
        public uint m_dwDecGamePointTick = 0;// 减游戏点的间隔
        public int m_nPayMentPoint = 0;// 秒卡点
        public uint m_dwPayMentPointTick = 0;// 秒卡点间隔
        public uint m_dwDecHPTick = 0;// 减HP间隔
        public uint m_dwIncHPTick = 0;// 加HP间隔
        public TPlayObject m_GetWhisperHuman = null;// 侦听私聊对象
        public uint m_dwClearObjTick = 0;// 清除对像间隔
        public ushort m_wContribution = 0;// 贡献度
        public string m_sRankLevelName = string.Empty;// 显示名称格式串
        public bool m_boFilterAction = false;// 动作过滤
        public bool m_boClientFlag = false;// 客户端标志
        public byte m_nStep = 0;
        public int m_nClientFlagMode = 0;
        public uint m_dwAutoGetExpTick = 0;// 自动泡点的时间间隔
        public int m_nAutoGetExpTime = 0;// 自动泡点时间
        public UInt32 m_nAutoGetExpPoint = 0;// 自动泡点数
        public TEnvirnoment m_AutoGetExpEnvir = null;// 自动泡点地图
        public bool m_boAutoGetExpInSafeZone = false;
        public List<TDynamicVar> m_DynamicVarList = null;// 自定义变量列表
        public uint m_dwClientTick = 0;// 客户端间隔
        public bool m_boTestSpeedMode = false;// 进入速度测试模式
        public List<TBigStorage> m_BigStorageItemList = null;// 无限仓库
        public bool m_boRemoteMsg = false;// 是否允许接受消息
        public bool m_boAllowReAlive = false;// 是否允许复活
        /// <summary>
        /// 是否是离线挂机人物
        /// </summary>
        public bool m_boNotOnlineAddExp = false;
        /// <summary>
        /// 离线挂机开始时间
        /// </summary>
        public uint m_dwStartNotOnlineAddExpTime = 0;
        /// <summary>
        /// 离线挂机时长
        /// </summary>
        public uint m_dwNotOnlineAddExpTime = 0;
        /// <summary>
        /// 离线挂机每分钟增加经验值
        /// </summary>
        public uint m_nNotOnlineAddExpPoint = 0;
        /// <summary>
        /// 是否踢出自动挂机人物
        /// </summary>
        public bool m_boKickAutoAddExpUser = false;
        public uint m_dwAutoAddExpPointTick = 0;
        public uint m_dwAutoAddExpPointTimeTick = 0;
        /// <summary>
        /// 是否自动增加经验(挂机)
        /// </summary>
        public bool m_boStartAutoAddExpPoint = false;
        /// <summary>
        /// 自动回复信息
        /// </summary>
        public string m_sAutoSendMsg = String.Empty;
        public byte m_btHearMsgFColor = 0;// 说话字体颜色
        public byte m_btWhisperMsgFColor = 0;// 私聊字体颜色
        public bool m_boTimeGoto = false;
        public uint m_dwTimeGotoTick = 0;
        public string m_sTimeGotoLable = string.Empty;
        /// <summary>
        /// Delaygoto延时跳转
        /// </summary>
        public TMerchant m_TimeGotoNPC = null;
        public int m_nDealGoldPose = 0;
        public int m_nBigStoragePage = 0;// 无限仓库的当前页数
        public uint m_dwDedingUseTick = 0;// 地钉使用间隔
        /// <summary>
        /// 是否运行个人机器人
        /// </summary>
        public bool m_boRunPlayRobotManage = false;
        /// <summary>
        /// 人物个人机器人
        /// </summary>
        public TPlayRobotManage m_PlayRobotManage = null;
        /// <summary>
        /// 是否下线触发
        /// </summary>
        public bool m_boPlayOffLine = false;
        /// <summary>
        /// 人物变量(整形)
        /// </summary>
        public int[] m_nInteger = new int[99];
        /// <summary>
        /// 人物变量（字符串）
        /// </summary>
        public string[] m_sString = new string[99];
        /// <summary>
        /// 徒弟数
        /// </summary>
        public ushort m_wMasterCount = 0;
        /// <summary>
        /// 人物排行
        /// </summary>
        public List<string> m_PlayOrderList = null;
        public int m_nSelPlayOrderType = 0;// 选择排行类型 0-等级 1-战士 2-法师 3-道士 4-名师
        public int m_nPlayOrderPage = 0;// 选择人物排行页数
        public bool m_boGetMyLevelOrder = false;// 取自己的排名
        /// <summary>
        /// 是否正在读取英雄数据
        /// </summary>
        public bool m_boWaitHeroDate = false;
        public uint m_TargetTime = 0;// 锁定目标间隔
        public bool m_boHasHero = false;// 是否有英雄(白门英雄)
        public string m_sHeroCharName;// 英雄名称
        public string m_sTempHeroCharName;// 临时英雄名称,创建英雄时保存用
        /// <summary>
        /// 我的英雄
        /// </summary>
        public TBaseObject m_MyHero = null;
        /// <summary>
        /// 是否可以召唤英雄
        /// </summary>
        public bool m_boCallHero = false; 
        /// <summary>
        /// 是否存英雄,1-存英雄 
        /// </summary>
        public byte n_HeroSave = 0;
        /// <summary>
        /// 英雄的类型  0-白日门英雄 1-卧龙英雄
        /// </summary>
        public byte n_myHeroTpye = 0;
        /// <summary>
        /// 是否请过酒 T-请过酒 
        /// </summary>
        public bool m_boPlayDrink = false;
        /// <summary>
        /// 喝酒的醉酒值 0-NPC 1-玩家 
        /// </summary>
        public byte[] n_DrinkValue = new byte[2];
        /// <summary>
        /// 喝酒的次数(斗酒一次最高6次) 
        /// </summary>
        public byte n_DrinkCount = 0;
        /// <summary>
        /// 是否有卧龙英雄
        /// </summary>
        public bool m_boHasHeroTwo = false; 
        /// <summary>
        /// 保存临时英雄类型
        /// </summary>
        public byte n_tempHeroTpye = 0;
        /// <summary>
        /// 是否酿酒
        /// </summary>
        public bool m_boMakeWine = false;
        /// <summary>
        /// 酿酒的类型 1-普通酒 2-药酒  
        /// </summary>
        public byte n_MakeWineType = 0;
        /// <summary>
        /// 酿酒的时间,即还有多长时间可以取回酒(秒) 
        /// </summary>
        public UInt16 m_MakeWineTime = 0; 
        /// <summary>
        /// 酿酒后,应该可以得到酒的类型 
        /// </summary>
        public byte n_MakeWineItmeType = 0;
        /// <summary>
        /// 酿酒后,应该可以得到酒的品质 
        /// </summary>
        public byte n_MakeWineQuality = 0; 
        /// <summary>
        /// 酿酒后,应该可以得到酒的酒精度 
        /// </summary>
        public byte n_MakeWineAlcohol = 0; 
        /// <summary>
        /// 增加酒量进度的间隔
        /// </summary>
        public uint m_dwAddAlcoholTick = 0;  
        /// <summary>
        /// 减少醉酒度的间隔
        /// </summary>
        public uint m_dwDecWineDrinkValueTick = 0;  
        /// <summary>
        /// 饮酒时酒的品质
        /// </summary>
        public byte n_DrinkWineQuality = 0;
        /// <summary>
        /// 饮酒时酒的度数
        /// </summary>
        public byte n_DrinkWineAlcohol = 0; 
        /// <summary>
        /// 喝酒醉了
        /// </summary>
        public bool n_DrinkWineDrunk = false; 
        /// <summary>
        /// 站在泉水眼的时间
        /// </summary>
        public ushort n_InFountainTime = 0; 
        /// <summary>
        /// 使用药酒时间,计算长时间没使用药酒
        /// </summary>
        public UInt16 dw_UseMedicineTime = 0;
        /// <summary>
        /// 药力值等级
        /// </summary>
        public UInt16 n_MedicineLevel = 0; 
        /// <summary>
        /// 取行会泉水日期
        /// </summary>
        public int m_GiveGuildFountationDate = 0;
        public UInt32 m_Exp68 = 0;// 酒气护体当前经验 
        public UInt32 m_MaxExp68 = 0;// 酒气护体升级经验 
        /// <summary>
        /// 是否点击,让NPC走动 
        /// </summary>
        public bool bo_NPCMove = false;
        /// <summary>
        /// 是否学习过内功
        /// </summary>
        public bool m_boTrainingNG = false; 
        /// <summary>
        /// 内功等级
        /// </summary>
        public byte m_NGLevel = 0; 
        /// <summary>
        /// 内功心法当前经验
        /// </summary>
        public UInt32 m_ExpSkill69 = 0; 
        /// <summary>
        /// 内功心法升级经验
        /// </summary>
        public uint m_MaxExpSkill69 = 0;
        /// <summary>
        /// 当前内力值
        /// </summary>
        public uint m_Skill69NH = 0; 
        /// <summary>
        /// 最大内力值
        /// </summary>
        public UInt32 m_Skill69MaxNH = 0; 
        /// <summary>
        /// 增加内力值计时
        /// </summary>
        public uint m_dwIncNHTick = 0; 
        /// <summary>
        /// 增加内力恢复速度 % 
        /// </summary>
        public uint m_dwIncAddNHTick = 0; 
        /// <summary>
        /// 内力恢复速度加几点
        /// </summary>
        public uint m_dwIncAddNHPoint = 0; 
        /// <summary>
        /// 随机取的宝箱物品
        /// </summary>
        public List<TBoxsInfo> m_Boxs; 
        /// <summary>
        /// 转动宝箱的次数
        /// </summary>
        public byte n_OpenBox = 0;
        /// <summary>
        /// 转宝箱累计消费(元宝)
        /// </summary>
        public int n_IncUsesGameGold = 0;
        /// <summary>
        /// 转宝箱累计消费(金币)
        /// </summary>
        public int n_IncUsesGold = 0;
        /// <summary>
        /// 随机给玩家的物品ID
        /// </summary>
        public int n_BoxsItmeID = 0;
        /// <summary>
        /// 是否宝箱在打开
        /// </summary>
        public bool m_boOpenBox = false; 
        /// <summary>
        /// 玩家当前等级排名
        /// </summary>
        public int n_LevelOrder = 0; 
        /// <summary>
        /// 
        /// </summary>
        public uint dwGetLevelOrderTick = 0; 
        /// <summary>
        /// 穿人模式的间隔
        /// </summary>
        public uint dwRunHumanModeTick = 0;
        /// <summary>
        /// 穿人模式的时间
        /// </summary>
        public uint dwRunHumanModeTime = 0; 
        /// <summary>
        /// 是否可以改变穿人模式
        /// </summary>
        public bool m_boRunHumanMode = false;  
        /// <summary>
        /// 聚灵珠聚集时间
        /// </summary>
        public int n_UsesItemTick = 0; 
        /// <summary>
        /// 聚灵珠发送剩余时间消息的时间
        /// </summary>
        public int n_UsesItemTime = 0; 
        /// <summary>
        /// 是否开通元宝寄售
        /// </summary>
        public bool bo_YBDEAL = false;
        public uint m_nRecallHeroTime = 0;// 召唤英雄间隔时间 
        /// <summary>
        /// 个人定时器
        /// </summary>
        public uint[] AutoTimerTick = new uint[20];
        /// <summary>
        /// 个人定时器 时间间隔 
        /// </summary>
        public int[] AutoTimerStatus = new int[20];
        /// <summary>
        /// 是否在挑战中
        /// </summary>
        public bool m_boChallengeing = false;
        /// <summary>
        /// 挑战的对像
        /// </summary>
        public TPlayObject m_ChallengeCreat = null;
        /// <summary>
        /// 挑战物品列表
        /// </summary>
        public List<IntPtr> m_ChallengeItemList = null;
        /// <summary>
        /// 挑战的金币数量
        /// </summary>
        public int m_nChallengeGolds = 0;
        /// <summary>
        /// 挑战的金刚石
        /// </summary>
        public int m_nChallengeGAMEDIAMOND = 0;
        /// <summary>
        /// 确认开始挑战标志
        /// </summary>
        public bool m_boChallengeOK = false;
        /// <summary>
        /// 挑战放物品最后操作时间
        /// </summary>
        public uint m_ChallengeLastTick = 0; 
        /// <summary>
        /// 挑战计时
        /// </summary>
        public uint m_ChallengeTime = 0;
        /// <summary>
        /// 魔血石类HP 使用间隔
        /// </summary>
        public uint dwRockAddHPTick = 0;
        /// <summary>
        /// 魔血石类MP 使用间隔
        /// </summary>
        public uint dwRockAddMPTick = 0;
        /// <summary>
        /// 是否可以刷新包裹
        /// </summary>
        public bool m_boCanQueryBag = false;
        /// <summary>
        /// 是否可以刷新商铺
        /// </summary>
        public bool m_boCanQueryShopItme = false; 
        public bool m_boHeroLogOut = false;// 英雄退出(包裹传递时用于判断) 
        public unsafe TUserMagic* m_MagicSkill_200;// 怒之攻杀 *
        public unsafe TUserMagic* m_MagicSkill_201;// 静之攻杀
        public unsafe TUserMagic* m_MagicSkill_202;// 怒之半月 *
        public unsafe TUserMagic* m_MagicSkill_203;// 静之半月
        public unsafe TUserMagic* m_MagicSkill_204;// 怒之烈火 *
        public unsafe TUserMagic* m_MagicSkill_205;// 静之烈火
        public unsafe TUserMagic* m_MagicSkill_206;// 怒之逐日 *
        public unsafe TUserMagic* m_MagicSkill_207;// 静之逐日
        public unsafe TUserMagic* m_MagicSkill_208;// 怒之火球 *
        public unsafe TUserMagic* m_MagicSkill_209;// 静之火球
        public unsafe TUserMagic* m_MagicSkill_210;// 怒之大火球 *
        public unsafe TUserMagic* m_MagicSkill_211;// 静之大火球
        public unsafe TUserMagic* m_MagicSkill_212;// 怒之火墙 *
        public unsafe TUserMagic* m_MagicSkill_213;// 静之火墙
        public unsafe TUserMagic* m_MagicSkill_214;// 怒之地狱火 *
        public unsafe TUserMagic* m_MagicSkill_215;// 静之地狱火
        public unsafe TUserMagic* m_MagicSkill_216;// 怒之疾光电影 *
        public unsafe TUserMagic* m_MagicSkill_217;// 静之疾光电影
        public unsafe TUserMagic* m_MagicSkill_218;// 怒之爆裂火焰 *
        public unsafe TUserMagic* m_MagicSkill_219;// 静之爆裂火焰
        public unsafe TUserMagic* m_MagicSkill_220;// 怒之冰咆哮 *
        public unsafe TUserMagic* m_MagicSkill_221;// 静之冰咆哮
        public unsafe TUserMagic* m_MagicSkill_222;// 怒之雷电 *
        public unsafe TUserMagic* m_MagicSkill_223;// 静之雷电
        public unsafe TUserMagic* m_MagicSkill_224;// 怒之地狱雷光 *
        public unsafe TUserMagic* m_MagicSkill_225;// 静之地狱雷光
        public unsafe TUserMagic* m_MagicSkill_226;// 怒之寒冰掌 *
        public unsafe TUserMagic* m_MagicSkill_227;// 静之寒冰掌
        public unsafe TUserMagic* m_MagicSkill_228;// 怒之灭天火 *
        public unsafe TUserMagic* m_MagicSkill_229;// 静之灭天火
        public unsafe TUserMagic* m_MagicSkill_230;// 怒之火符 *
        public unsafe TUserMagic* m_MagicSkill_231;// 静之火符
        public unsafe TUserMagic* m_MagicSkill_232;// 怒之噬血 *
        public unsafe TUserMagic* m_MagicSkill_233;// 静之噬血
        public unsafe TUserMagic* m_MagicSkill_234;// 怒之流星火雨 *
        public unsafe TUserMagic* m_MagicSkill_235;// 静之流星火雨
        public unsafe TUserMagic* m_MagicSkill_236;// 怒之内功剑法 *
        public unsafe TUserMagic* m_MagicSkill_237;// 静之内功剑法
        public TagMapInfo[] m_TagMapInfos;// 人物记路标石
        public UInt32 m_GetExp = 0;// 人物取得的经验,$GetExp变量使用 
        public int m_BuyShopPrice = 0;// 每次商铺花的元宝数量，$BUYSHOP变量使用
        public int m_UseGameGird = 0;// 每次使用灵符数，$USEGAMEGIRD变量使用
        public string m_sMapName136;//魔王领地图
        public Dictionary<int, TServerProcess> FServerProcess;
        public delegate void TServerProcess(TProcessMessage ProcessMsg, ref bool boResult);
        #endregion

        public unsafe TPlayObject()
            : base()
        {
            m_boHeroAutoTraining = false;// 初始化为False;
            m_dwIncAddNHTick = 0;// 增加内力恢复速度 %
            m_dwIncAddNHPoint = 0;// 增加内力恢复点
            m_nBatterUseTick = HUtil32.GetTickCount();// 初始化连击使用间隔变量
            m_nUserCmdNPC = null;// 客户端按确认所执行的脚本
            m_btRaceServer = Grobal2.RC_PLAYOBJECT;
            m_boEmergencyClose = false;
            m_boSwitchData = false;
            m_boReconnection = false;
            m_boKickFlag = false;
            m_boSoftClose = false;
            m_boReadyRun = false;
            m_dwSaveRcdTick = HUtil32.GetTickCount();
            m_boWantRefMsg = true;
            m_boRcdSaveding = false;// 是否正在保存数据
            m_boRcdSaved = false;
            m_boDieInFight3Zone = false;
            m_Script = null;
            m_boTimeRecall = false;
            m_sMoveMap = "";
            m_nMoveX = 0;
            m_nMoveY = 0;
            m_sLastMapName = "";// 人物死亡地图
            m_nLastCurrX = 0;// 人物死亡地图所在座标X
            m_nLastCurrY = 0;// 人物死亡地图所在座标Y
            m_boBuyShopItem = false;// 正在购买商铺物品中
            m_boDealing = false;
            m_DealCreat = null;
            m_GroupOwner = null;
            m_GroupMembers = new List<TPlayObject>();
            m_boHearWhisper = true;
            m_boBanShout = true;
            m_boBanGmMsg = true;// 允许接收所有喊话
            m_boBanGuildChat = true;
            m_boAllowDeal = true;
            m_boAllowGroupReCall = false;
            m_BlockWhisperList = new List<string>();
            m_wGroupRcallTime = 0;
            m_dwGroupRcallTick = HUtil32.GetTickCount();
            m_SellOffItemList = new List<IntPtr>();// 元宝寄售物品列表
            m_RefineItemList = new List<IntPtr>();// 粹练物品列表
            m_DealItemList = new List<IntPtr>();
            m_nDealGolds = 0;
            m_StorageItemList = new List<IntPtr>();
            m_boAllowGroup = false;
            m_boAllowGuild = false;
            m_dwShoutMsgTick = 0;
            m_dwRunTick = HUtil32.GetTickCount();
            m_nRunTime = 250;
            m_dwSearchTime = 1000;
            m_dwSearchTick = HUtil32.GetTickCount();
            m_nViewRange = 12;
            m_boNewHuman = false;
            m_boLoginNoticeOK = false;
            bo6AB = false;
            m_boExpire = false;
            m_boSendNotice = false;
            m_dwCheckDupObjTick = HUtil32.GetTickCount();
            dwTick578 = HUtil32.GetTickCount();
            dwTick57C = HUtil32.GetTickCount();
            m_boInSafeArea = false;
            m_dwMagicAttackTick = HUtil32.GetTickCount();
            m_dwMagicAttackInterval = 0;
            m_dwAttackTick = HUtil32.GetTickCount();
            m_dwMoveTick = HUtil32.GetTickCount();
            m_dwTurnTick = HUtil32.GetTickCount();
            m_dwActionTick = HUtil32.GetTickCount();
            m_dwAttackCount = 0;
            m_dwAttackCountA = 0;
            m_dwMagicAttackCount = 0;
            m_dwMoveCount = 0;
            m_dwMoveCountA = 0;
            m_nOverSpeedCount = 0;
            m_dwSayMsgTick = HUtil32.GetTickCount();
            m_boDisableSayMsg = false;
            m_dwDisableSayMsgTick = HUtil32.GetTickCount();
            m_dLogonTime = DateTime.Now;
            m_dwLogonTick = HUtil32.GetTickCount();
            m_boSwitchData = false;
            m_boSwitchDataSended = false;
            m_nWriteChgDataErrCount = 0;
            m_dwShowLineNoticeTick = HUtil32.GetTickCount();
            m_nShowLineNoticeIdx = 0;
            m_nSoftVersionDateEx = 0;
            m_CanJmpScriptLableList = new List<string>();
            m_nKillMonExpRate = 100;
            m_nOldKillMonExpRate = m_nKillMonExpRate;
            m_nItmeIncMonExpRate = 0;// 使用套装增加的经验
            m_dwRateTick = HUtil32.GetTickCount();
            m_nPowerRate = 100;
            m_boSetStoragePwd = false;
            m_boReConfigPwd = false;
            m_boCheckOldPwd = false;
            m_boUnLockPwd = false;
            m_boUnLockStoragePwd = false;
            m_boPasswordLocked = false;// 锁仓库
            m_btPwdFailCount = 0;
            m_sTempPwd = "";
            m_sStoragePwd = "";
            m_boFilterSendMsg = false;
            m_boCanDeal = true;
            m_boCanDrop = true;
            m_boCanGetBackItem = true;
            m_boCanWalk = true;
            m_boCanRun = true;
            m_boCanHit = true;
            m_boCanSpell = true;
            m_boCanUseItem = true;
            m_nMemberType = 0;
            m_nMemberLevel = 0;
            m_nGameGold = 0;
            m_nGAMEDIAMOND = 0;// 金刚石
            m_nGAMEGIRD = 0;// 灵符
            m_boDecGameGold = false;
            m_nDecGameGold = 1;
            m_dwDecGameGoldTick = HUtil32.GetTickCount();// 60 * 1000
            m_dwDecGameGoldTime = 60000;
            m_boIncGameGold = false;
            m_nIncGameGold = 1;
            m_dwIncGameGoldTick = HUtil32.GetTickCount();// 60 * 1000
            m_dwIncGameGoldTime = 60000;
            m_nGamePoint = 0;
            m_dwIncGamePointTick = HUtil32.GetTickCount();
            m_dwDecGamePointTick = HUtil32.GetTickCount();
            m_nPayMentPoint = 0;
            m_DearHuman = null;
            m_MasterHuman = null;
            m_MasterList = new List<TPlayObject>();
            m_boSendMsgFlag = false;
            m_boChangeItemNameFlag = false;
            m_boCanMasterRecall = false;
            m_boCanDearRecall = false;
            m_dwDearRecallTick = HUtil32.GetTickCount();
            m_dwMasterRecallTick = HUtil32.GetTickCount();
            m_btReColorIdx = 0;
            m_GetWhisperHuman = null;
            m_boOnHorse = false;
            m_wContribution = 0;
            m_sRankLevelName = GameMsgDef.g_sRankLevelName;
            m_boFixedHideMode = true;
            m_nStep = 0;
            m_nClientFlagMode = -1;
            m_dwAutoGetExpTick = HUtil32.GetTickCount();
            m_nAutoGetExpPoint = 0;
            m_AutoGetExpEnvir = null;
            m_dwMagicHitIntervalTime = GameConfig.dwMagicHitIntervalTime;// 魔法间隔
            m_dwRunIntervalTime = GameConfig.dwRunIntervalTime;// 跑间隔
            m_dwWalkIntervalTime = GameConfig.dwWalkIntervalTime;// 走路间隔
            m_dwTurnIntervalTime = GameConfig.dwTurnIntervalTime;// 换方向间隔
            m_dwActionIntervalTime = GameConfig.dwActionIntervalTime;// 组合操作间隔
            m_dwRunLongHitIntervalTime = GameConfig.dwRunLongHitIntervalTime;// 组合操作间隔
            m_dwRunHitIntervalTime = GameConfig.dwRunHitIntervalTime;// 组合操作间隔
            m_dwWalkHitIntervalTime = GameConfig.dwWalkHitIntervalTime;// 组合操作间隔
            m_dwRunMagicIntervalTime = GameConfig.dwRunMagicIntervalTime;// 跑位魔法间隔
            m_DynamicVarList = new List<TDynamicVar>();
            m_boTestSpeedMode = false;
            m_boLockLogon = true;
            m_boLockLogoned = false;
            m_boRemoteMsg = false;// 是否允许接受消息
            m_boNotOnlineAddExp = false;// 是否是离线挂机人物
            m_boStartAutoAddExpPoint = false;// 是否开始增加经验
            m_dwStartNotOnlineAddExpTime = 0;// 离线挂机开始时间
            m_dwNotOnlineAddExpTime = 0;// 离线挂机时长
            m_nNotOnlineAddExpPoint = 0;// 离线挂机每分钟增加经验值
            m_dwAutoAddExpPointTick = HUtil32.GetTickCount();
            m_dwAutoAddExpPointTimeTick = HUtil32.GetTickCount();
            m_sAutoSendMsg = "您好，我正在离线泡点中......";// 自动回复信息
            m_boKickAutoAddExpUser = false;
            m_boTimeGoto = false;
            m_dwTimeGotoTick = HUtil32.GetTickCount();
            m_sTimeGotoLable = "";
            m_TimeGotoNPC = null;
            m_nBigStoragePage = 0;// 无限仓库的当前页数
            m_nDealGoldPose = 0;
            m_boPlayOffLine = true;// 是否允许下线触发
            m_dwDedingUseTick = 0;
            this.m_nCopyHumanLevel = 0;
            m_boAllowReAlive = false;// 是否允许复活
            m_boRunPlayRobotManage = true;// 是否运行个人机器人
            m_PlayRobotManage = new TPlayRobotManage();// 人物个人机器人
            m_PlayRobotManage.PlayObject = this;
            m_wMasterCount = 0;// 徒弟数
            m_PlayOrderList = new List<string>();// 人物排行
            m_nSelPlayOrderType = 0;// 选择排行类型
            m_nPlayOrderPage = 0;// 选择人物排行页数
            m_boGetMyLevelOrder = false;
            m_BigStorageItemList = null;// 无限仓库
            m_btHearMsgFColor = 0x00;// 喊话字体颜色
            m_btWhisperMsgFColor = 0xFC;// 私聊字体颜色
            m_MyHero = null;// 我的英雄
            m_boHasHero = false;
            m_boHasHeroTwo = false;
            m_sHeroCharName = "";
            m_sTempHeroCharName = "";
            m_sDeputyHeroCharName = "";
            m_boWaitHeroDate = false;
            m_boCallHero = true;// 是否可以召唤英雄
            n_HeroSave = 0;// 是否保存英雄 
            m_boPlayDrink = false;// 是否请过酒 T-请过酒 
            n_DrinkValue[0] = 0;// 喝酒的醉酒值 0-NPC 1-玩家 
            n_DrinkValue[1] = 0;
            n_DrinkCount = 0;// 喝酒的次数(斗酒一次最高6次) 
            m_boMakeWine = false;// 是否酿酒
            m_MakeWineTime = 0;// 酿酒的时间,即还有多长时间可以取回酒 
            n_MakeWineItmeType = 0;// 酿酒后,应该可以得到酒的类型 
            n_MakeWineQuality = 0;// 酿酒后,应该可以得到酒的品质 
            n_MakeWineAlcohol = 0;// 酿酒后,应该可以得到酒的酒精度 
            n_MakeWineType = 0;// 酿酒的类型 1-普通酒 2-药酒  
            m_dwAddAlcoholTick = HUtil32.GetTickCount();// 增加酒量进度的间隔  
            m_dwDecWineDrinkValueTick = HUtil32.GetTickCount();// 减少醉酒度的间隔  
            n_DrinkWineQuality = 0;// 饮酒时酒的品质 
            n_DrinkWineAlcohol = 0;// 饮酒时酒的度数 
            n_DrinkWineDrunk = false;// 喝酒醉了 
            n_InFountainTime = 0;// 站在泉水眼的时间 
            dw_UseMedicineTime = 0;// 使用药酒时间,计算长时间没使用药酒 
            n_MedicineLevel = 0;// 药力值等级 
            m_GiveGuildFountationDate = 0;// 取行会泉水日期
            m_Exp68 = 0;// 酒气护体当前经验 
            m_MaxExp68 = 0;// 酒气护体升级经验 
            bo_NPCMove = false;// 是否点击,让NPC走动 
            n_LevelOrder = 0;// 玩家当前等级排名 
            m_Boxs = new List<TBoxsInfo>();// 随机选取的宝箱物品 
            m_boOpenBox = false;// 是否宝箱在打开
            m_sScriptLable = "";
            m_dwSayMyInfoTick = HUtil32.GetTickCount();
            m_nMasterNo = 0;// 徒弟排名
            m_MasterNoList = new List<string>();// 徒弟排名列表
            m_boChallengeing = false;// 是否在挑战中
            m_ChallengeCreat = null;// 挑战对像
            m_ChallengeItemList = new List<IntPtr>();// 挑战物品列表
            m_nChallengeGolds = 0;// 挑战的金币数量
            m_nChallengeGAMEDIAMOND = 0;// 挑战的金刚石
            m_boAddToMaped = false;// 地图是否计数
            m_boCanQueryBag = false;// 是否可以刷新包裹
            m_boCanQueryShopItme = false;// 是否可以刷新商铺
            m_boHeroLogOut = false;// 英雄退出
            m_boTrainingNG = false;// 是否学习过内功
            m_NGLevel = 1;// 内功等级 
            m_ExpSkill69 = 0;// 内功心法当前经验
            m_MaxExpSkill69 = 0;// 内功心法升级经验
            m_Skill69NH = 0;// 当前内力值
            m_Skill69MaxNH = 0;// 最大内力值
            m_dwIncNHTick = HUtil32.GetTickCount();// 增加内力值计时
            this.m_MagicSkill_76 = null;
            this.m_MagicSkill_77 = null;
            this.m_MagicSkill_78 = null;
            this.m_MagicSkill_79 = null;
            this.m_MagicSkill_80 = null;
            this.m_MagicSkill_81 = null;
            this.m_MagicSkill_82 = null;
            this.m_MagicSkill_83 = null;
            this.m_MagicSkill_84 = null;
            this.m_MagicSkill_85 = null;
            this.m_MagicSkill_86 = null;
            this.m_MagicSkill_87 = null;
            this.m_MagicSkill_69 = null;
            m_MagicSkill_200 = null;// 怒之攻杀
            m_MagicSkill_201 = null;// 静之攻杀
            m_MagicSkill_202 = null;// 怒之半月
            m_MagicSkill_203 = null;// 静之半月
            m_MagicSkill_204 = null;// 怒之烈火
            m_MagicSkill_205 = null;// 静之烈火
            m_MagicSkill_206 = null;// 怒之逐日
            m_MagicSkill_207 = null;// 静之逐日
            m_MagicSkill_208 = null;// 怒之火球
            m_MagicSkill_209 = null;// 静之火球
            m_MagicSkill_210 = null;// 怒之大火球
            m_MagicSkill_211 = null;// 静之大火球
            m_MagicSkill_212 = null;// 怒之火墙
            m_MagicSkill_213 = null;// 静之火墙
            m_MagicSkill_214 = null;// 怒之地狱火
            m_MagicSkill_215 = null;// 静之地狱火
            m_MagicSkill_216 = null;// 怒之疾光电影
            m_MagicSkill_217 = null;// 静之疾光电影
            m_MagicSkill_218 = null;// 怒之爆裂火焰
            m_MagicSkill_219 = null;// 静之爆裂火焰
            m_MagicSkill_220 = null;// 怒之冰咆哮
            m_MagicSkill_221 = null;// 静之冰咆哮
            m_MagicSkill_222 = null;// 怒之雷电
            m_MagicSkill_223 = null;// 静之雷电
            m_MagicSkill_224 = null;// 怒之地狱雷光
            m_MagicSkill_225 = null;// 静之地狱雷光
            m_MagicSkill_226 = null;// 怒之寒冰掌
            m_MagicSkill_227 = null;// 静之寒冰掌
            m_MagicSkill_228 = null;// 怒之灭天火
            m_MagicSkill_229 = null;// 静之灭天火
            m_MagicSkill_230 = null;// 怒之火符
            m_MagicSkill_231 = null;// 静之火符
            m_MagicSkill_232 = null;// 怒之噬血
            m_MagicSkill_233 = null;// 静之噬血
            m_MagicSkill_234 = null;// 怒之流星火雨
            m_MagicSkill_235 = null;// 静之流星火雨
            m_MagicSkill_236 = null;// 怒之内功剑法
            m_MagicSkill_237 = null;// 静之内功剑法
            m_TagMapInfos = new TagMapInfo[6];// 人物记路标石
            m_GetExp = 0;// 人物取得的经验,$GetExp变量使用
            m_BuyShopPrice = 0;// 每次商铺花的元宝数量，$BuyShop变量使用
            m_UseGameGird = 0;// 每次使用灵符数，$USEGAMEGIRD变量使用
            m_sMapQFStr = "";// SENDTIMEMSG命令设置的触发段
            m_sMapQFStr1 = "";// SENDMSGWINDOWS命令设置的触发段
            m_boForMapShowHint = false;// 换地图是否还显示倒计时信息
            m_boShowExpCrystal = false;// 是否显示天地结晶图标
            m_CrystalLevel = 0;// 天地结晶等级
            m_CrystalExp = 0;// 天地结晶当前经验
            m_CrystalMaxExp = 0;// 天地结晶升级经验
            m_CrystalNGExp = 0;// 天地结晶当前内功经验
            m_CrystalNGMaxExp = 0;// 天地结晶内功升级经验
            m_boGetExpCrystalExp = false;// 是否可以提取经验
            m_nGetCrystalExp = 0;// 可提取天地结晶经验
            m_nGetCrystalNGExp = 0;// 天可提取地结晶内功经验
            this.m_boRobotObject = false;
            m_sMapName136 = "";// 魔王岭地图名称
            InitProcessMessageList();
        }

        ~TPlayObject()
        {
            if (m_SellOffItemList != null)
            {
                if (m_SellOffItemList.Count > 0)
                {
                    for (int I = 0; I < m_SellOffItemList.Count; I++)// 元宝寄售物品列表
                    {
                        unsafe
                        {
                            if (((TUserItem*)(m_SellOffItemList[I])) != null)
                            {
                                Marshal.FreeHGlobal((IntPtr)m_SellOffItemList[I]);
                            }
                        }
                    }
                }
                m_SellOffItemList = null;
            }
            if (m_RefineItemList != null)
            {
                if (m_RefineItemList.Count > 0)
                {
                    for (int I = 0; I < m_RefineItemList.Count; I++) // 粹练物品列表
                    {
                        unsafe
                        {
                            if (m_RefineItemList[I] != null)
                            {
                                Dispose(m_RefineItemList);
                            }
                        }
                    }
                }
                m_RefineItemList = null;
            }
            if (m_DealItemList != null)
            {
                if (m_DealItemList.Count > 0)
                {
                    for (int I = 0; I < m_DealItemList.Count; I++)
                    {
                        unsafe
                        {
                            if (m_DealItemList[I] != null)
                            {
                                Dispose(m_DealItemList[I]);
                            }
                        }
                    }
                }
                m_DealItemList = null;
            }
            if (m_ChallengeItemList != null)// 挑战物品列表
            {
                if (m_ChallengeItemList.Count > 0)
                {
                    for (int I = 0; I < m_ChallengeItemList.Count; I++)
                    {
                        unsafe
                        {
                            if (((TUserItem*)(m_ChallengeItemList[I])) != null)
                            {
                                Dispose(m_ChallengeItemList[I]);
                            }
                        }
                    }
                }
                m_ChallengeItemList = null;
            }
            if (m_StorageItemList != null)
            {
                if (m_StorageItemList.Count > 0)
                {
                    for (int I = 0; I < m_StorageItemList.Count; I++)
                    {
                        unsafe
                        {
                            if (m_StorageItemList[I] != null)
                            {
                                Dispose(m_StorageItemList[I]);
                            }
                        }
                    }
                }
                m_StorageItemList = null;
            }
            if (m_GroupMembers != null)
            {
                m_GroupMembers = null;
            }
            if (m_BlockWhisperList != null)
            {
                m_BlockWhisperList = null;
            }
            if (m_MasterList != null)
            {
                m_MasterList = null;
            }
            if (m_Boxs != null)
            {
                m_Boxs = null;
            }
            // 随机选取宝箱的物品
            if (m_DynamicVarList != null)
            {
                if (m_DynamicVarList.Count > 0)
                {
                    for (int I = 0; I < m_DynamicVarList.Count; I++)
                    {
                        if (((TDynamicVar)(m_DynamicVarList[I])) != null)
                        {
                            Dispose(((TDynamicVar)(m_DynamicVarList[I])));
                        }
                    }
                }
                m_DynamicVarList = null;
            }
            if (m_CanJmpScriptLableList != null)
            {
                m_CanJmpScriptLableList = null;
            }
            if (m_PlayRobotManage != null)
            {
                Dispose(m_PlayRobotManage);
            }
            if (m_PlayOrderList != null)
            {
                Dispose(m_PlayOrderList);
            }
            if (m_MasterNoList != null)
            {
                if (m_MasterNoList.Count > 0)
                {
                    for (int I = 0; I < m_MasterNoList.Count; I++)
                    {
                        //if (((TMasterList)(m_MasterNoList.Values[I])) != null)
                        //{
                        //    Dispose(((TMasterList)(m_MasterNoList.Values[I])));
                        //}
                    }
                }
                Dispose(m_MasterNoList);// 徒弟排名列表
            }
        }

        /// <summary>
        /// 初始化消息处理进程
        /// RM：客户端
        /// CM: 服务端
        /// </summary>
        internal void InitProcessMessageList()
        {
            FServerProcess = new Dictionary<int, TServerProcess>();
            FServerProcess[Grobal2.RM_LOGON] = ServerLogon;
            FServerProcess[Grobal2.CM_WALK] = ClientWalk;
            FServerProcess[Grobal2.CM_TURN] = ClientTurn;
            FServerProcess[Grobal2.CM_RUN] = ClientRun;
            FServerProcess[Grobal2.RM_STRUCK] = ServerStruck;
            FServerProcess[Grobal2.RM_STRUCK_MAG] = ServerStruck;
            FServerProcess[Grobal2.CM_HIT] = ClientAttack;
            FServerProcess[Grobal2.CM_HEAVYHIT] = ClientAttack;
            FServerProcess[Grobal2.CM_BIGHIT] = ClientAttack;
            FServerProcess[Grobal2.CM_POWERHIT] = ClientAttack;
            FServerProcess[Grobal2.CM_LONGHIT] = ClientAttack;
            FServerProcess[Grobal2.CM_WIDEHIT] = ClientAttack;
            FServerProcess[Grobal2.CM_CRSHIT] = ClientAttack;
            FServerProcess[Grobal2.CM_TWNHIT] = ClientAttack;
            FServerProcess[Grobal2.CM_QTWINHIT] = ClientAttack;
            FServerProcess[Grobal2.CM_CIDHIT] = ClientAttack;
            FServerProcess[Grobal2.CM_PHHIT] = ClientAttack;
            FServerProcess[Grobal2.CM_DAILY] = ClientAttack;
            FServerProcess[Grobal2.CM_FIREHIT] = ClientAttack;
            FServerProcess[Grobal2.CM_4FIREHIT] = ClientAttack;
            FServerProcess[Grobal2.CM_SANJUEHIT] = ClientAttack;
            FServerProcess[Grobal2.CM_ZHUIXINHIT] = ClientAttack;
            FServerProcess[Grobal2.CM_DUANYUEHIT] = ClientAttack;
            FServerProcess[Grobal2.CM_HENGSAOHIT] = ClientAttack;
            FServerProcess[Grobal2.CM_YTPDHIT] = ClientAttack;
            FServerProcess[Grobal2.CM_XPYJHIT] = ClientAttack;
            FServerProcess[Grobal2.CM_4LONGHIT] = ClientAttack;
            FServerProcess[Grobal2.CM_YUANYUEHIT] = ClientAttack;
            FServerProcess[Grobal2.RM_CHANGETURN] = ServerTurn;
            FServerProcess[Grobal2.RM_TURN] = ServerTurn;
            FServerProcess[Grobal2.RM_PUSH] = ServerTurn;
            FServerProcess[Grobal2.RM_RUSH] = ServerTurn;
            FServerProcess[Grobal2.RM_PUSHEX] = ServerTurn;
            FServerProcess[Grobal2.RM_RUSHKUNG] = ServerTurn;
            FServerProcess[Grobal2.RM_HEAR] = ServerSay;
            FServerProcess[Grobal2.RM_WHISPER] = ServerSay;
            FServerProcess[Grobal2.RM_CRY] = ServerSay;
            FServerProcess[Grobal2.RM_SYSMESSAGE] = ServerSay;
            FServerProcess[Grobal2.RM_MOVEMESSAGE] = ServerSay;
            FServerProcess[Grobal2.RM_GROUPMESSAGE] = ServerSay;
            FServerProcess[Grobal2.RM_SYSMESSAGE2] = ServerSay;
            FServerProcess[Grobal2.RM_GUILDMESSAGE] = ServerSay;
            FServerProcess[Grobal2.RM_SYSMESSAGE3] = ServerSay;
            FServerProcess[Grobal2.RM_PLAYDRINKSAY] = ServerSay;
            FServerProcess[Grobal2.RM_MERCHANTSAY] = ServerSay;// 滚动公告
            FServerProcess[Grobal2.RM_CHANGEMAP] = ServerChangeMap;
            FServerProcess[Grobal2.CM_SPELL] = ClientSpell;
            FServerProcess[Grobal2.RM_SPACEMOVE_SHOW] = ServerSpaceMoveShow;
            FServerProcess[Grobal2.RM_SPACEMOVE_SHOW2] = ServerSpaceMoveShow;
            FServerProcess[Grobal2.CM_BUTCH] = ClientButch;
            FServerProcess[Grobal2.CM_HORSERUN] = ClientHorseRun;
            FServerProcess[Grobal2.CM_SITDOWN] = ClientSitDown;
            FServerProcess[Grobal2.RM_WALK] = ServerWalk;
            FServerProcess[Grobal2.RM_HORSERUN] = ServerHorseRun;
            FServerProcess[Grobal2.RM_RUN] = ServerRun;
            FServerProcess[Grobal2.RM_LEVELUP] = ServerLevelUp;
            FServerProcess[Grobal2.RM_ABILITY] = ServerAbilty;

            FServerProcess[Grobal2.RM_SPELL] = ServerSpell;
            FServerProcess[Grobal2.RM_DEATH] = ServerDeath;
            FServerProcess[Grobal2.RM_BUTCH] = ServerButch;
            FServerProcess[Grobal2.RM_DIGUP] = ServerDigUp;
            FServerProcess[Grobal2.RM_FLYAXE] = ServerFlyAxe;
            FServerProcess[Grobal2.RM_LIGHTING] = ServerLighting;
            FServerProcess[Grobal2.RM_FAIRYATTACKRATE] = ServerFairyattackrate;
            FServerProcess[Grobal2.RM_SHOWEVENT] = ServerShowEvent;
            FServerProcess[Grobal2.RM_DAYCHANGING] = ServerDayChanging;
            FServerProcess[Grobal2.RM_NPCWALK] = ServerNpcWalk;
            FServerProcess[Grobal2.RM_ALIVE] = ServerAlive;
            FServerProcess[Grobal2.RM_CHANGEFACE] = ServerChangFace;
            FServerProcess[Grobal2.RM_PLAYDICE] = ServerPlayDice;
        }

        internal void ServerPlayDice(TProcessMessage ProcessMsg, ref bool boResult)
        {
            TMessageBodyWL MessageBodyWL = new TMessageBodyWL();
            MessageBodyWL.lParam1 = ProcessMsg.nParam1;
            MessageBodyWL.lParam2 = ProcessMsg.nParam2;
            MessageBodyWL.lTag1 = ProcessMsg.nParam3;
            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_PLAYDICE, ProcessMsg.BaseObject, ProcessMsg.wParam, 0, 0, 0);
            unsafe
            {
                byte[] data = new byte[sizeof(TMessageBodyWL)];
                fixed (byte* pb = data)
                {
                    *(TMessageBodyWL*)pb = MessageBodyWL;
                }
                SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TMessageBodyWL)) + EncryptUnit.EncodeString(ProcessMsg.sMsg));
            }
        }

        internal void ServerChangFace(TProcessMessage ProcessMsg, ref bool boResult)
        {
            if ((ProcessMsg.nParam1 != 0) && (ProcessMsg.nParam2 != 0))
            {
                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_CHANGEFACE, ProcessMsg.nParam1, HUtil32.LoWord(ProcessMsg.nParam2), HUtil32.HiWord(ProcessMsg.nParam2), 0, 0);
                TCharDesc CharDesc = new TCharDesc();
                CharDesc.feature = HUtil32.IntToObject<TBaseObject>(ProcessMsg.nParam2).GetFeature(this);
                CharDesc.Status = HUtil32.IntToObject<TBaseObject>(ProcessMsg.nParam2).m_nCharStatus;
                unsafe
                {
                    byte[] data = new byte[sizeof(TCharDesc)];
                    fixed (byte* pb = data)
                    {
                        *(TCharDesc*)pb = CharDesc;
                    }
                    SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TCharDesc)));
                }
            }
        }

        internal void ServerAlive(TProcessMessage ProcessMsg, ref bool boResult)
        {
            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_ALIVE, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, 0);
            TCharDesc CharDesc = new TCharDesc();
            CharDesc.feature = HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject).GetFeature(this);
            CharDesc.Status = HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject).m_nCharStatus;
            unsafe
            {
                byte[] data = new byte[sizeof(TCharDesc)];
                fixed (byte* pb = data)
                {
                    *(TCharDesc*)pb = CharDesc;
                }
                SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TCharDesc)));
            }
        }

        /// <summary>
        /// 酿酒NPC移动
        /// </summary>
        /// <param name="ProcessMsg"></param>
        /// <param name="boResult"></param>
        internal void ServerNpcWalk(TProcessMessage ProcessMsg, ref bool boResult)
        {
            if (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject) != this)
            {
                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_NPCWALK, ProcessMsg.BaseObject, ProcessMsg.nParam1,
                    ProcessMsg.nParam2, HUtil32.MakeWord((byte)ProcessMsg.wParam, HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject).m_btJob), 0);
                TCharDesc CharDesc = new TCharDesc();
                CharDesc.feature = HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject).GetFeature(HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject));
                CharDesc.Status = HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject).m_nCharStatus;
                unsafe
                {
                    byte[] data = new byte[sizeof(TCharDesc)];
                    fixed (byte* pb = data)
                    {
                        *(TCharDesc*)pb = CharDesc;
                    }
                    SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TCharDesc)));
                }
            }
        }

        internal void ServerDayChanging(TProcessMessage ProcessMsg, ref bool boResult)
        {
            int nObjCount = -1;
            if (this.m_PEnvir.m_boDARK)
            {
                nObjCount = 1;
            }
            else
            {
                switch (m_nBright)
                {
                    case 1:
                        nObjCount = 0;
                        break;
                    case 3:
                        nObjCount = 1;
                        break;
                    default:
                        nObjCount = 1;
                        break;
                }
            }
            if (this.m_PEnvir.m_boDAY)
            {
                nObjCount = 0;
            }
            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_DAYCHANGING, 0, m_nBright, nObjCount, 0, 0);
            SendSocket(this.m_DefMsg, "");
        }

        /// <summary>
        /// 显示地图事件
        /// </summary>
        /// <param name="ProcessMsg"></param>
        /// <param name="boResult"></param>
        internal void ServerShowEvent(TProcessMessage ProcessMsg, ref bool boResult)
        {
            TShortMessage ShortMessage = new TShortMessage();
            ShortMessage.Ident = (ushort)HUtil32.HiWord(ProcessMsg.nParam2);
            ShortMessage.wMsg = 0;
            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SHOWEVENT, ProcessMsg.nParam1, ProcessMsg.wParam,
                ProcessMsg.nParam2, ProcessMsg.nParam3, 0);
            unsafe
            {
                byte[] data = new byte[sizeof(TShortMessage)];
                fixed (byte* pb = data)
                {
                    *(TShortMessage*)pb = ShortMessage;
                    SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TShortMessage)));
                }
            }
        }

        internal unsafe void ServerFairyattackrate(TProcessMessage ProcessMsg, ref bool boResult)
        {
            TBaseObject BaseObject = HUtil32.IntToObject<TBaseObject>(ProcessMsg.nParam3);
            if (BaseObject != null)
            {
                TMessageBodyWL MessageBodyWL = new TMessageBodyWL();
                MessageBodyWL.lParam1 = BaseObject.m_nCurrX;
                MessageBodyWL.lParam2 = BaseObject.m_nCurrY;
                MessageBodyWL.lTag1 = ProcessMsg.nParam3;
                MessageBodyWL.lTag2 = ProcessMsg.wParam;
                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_FAIRYATTACKRATE, ProcessMsg.BaseObject, ProcessMsg.nParam1,
                    ProcessMsg.nParam2, HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject).m_btDirection, 0);
                byte[] data = new byte[sizeof(TMessageBodyWL)];
                fixed (byte* pb = data)
                {
                    *(TMessageBodyWL*)pb = MessageBodyWL;
                }
                SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TMessageBodyWL)));
            }
        }

        internal unsafe void ServerLighting(TProcessMessage ProcessMsg, ref bool boResult)
        {
            TBaseObject BaseObject = HUtil32.IntToObject<TBaseObject>(ProcessMsg.nParam3);
            if (BaseObject != null)
            {
                TMessageBodyWL MessageBodyWL = new TMessageBodyWL();
                MessageBodyWL.lParam1 = BaseObject.m_nCurrX;
                MessageBodyWL.lParam2 = BaseObject.m_nCurrY;
                MessageBodyWL.lTag1 = ProcessMsg.nParam3;
                MessageBodyWL.lTag2 = ProcessMsg.wParam;
                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_LIGHTING, ProcessMsg.BaseObject, ProcessMsg.nParam1,
                    ProcessMsg.nParam2, HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject).m_btDirection, 0);
                byte[] data = new byte[sizeof(TMessageBodyWL)];
                fixed (byte* pb = data)
                {
                    *(TMessageBodyWL*)pb = MessageBodyWL;
                }
                SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TMessageBodyWL)));
            }
        }

        internal unsafe void ServerFlyAxe(TProcessMessage ProcessMsg, ref bool boResult)
        {
            TBaseObject BaseObject = HUtil32.IntToObject<TBaseObject>(ProcessMsg.nParam3);
            if (BaseObject != null)
            {
                TMessageBodyW MessageBodyW = new TMessageBodyW();
                MessageBodyW.Param1 = (ushort)BaseObject.m_nCurrX;
                MessageBodyW.Param2 = (ushort)BaseObject.m_nCurrY;
                MessageBodyW.Tag1 = (ushort)HUtil32.LoWord(ProcessMsg.nParam3);
                MessageBodyW.Tag2 = (ushort)HUtil32.HiWord(ProcessMsg.nParam3);
                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_FLYAXE, ProcessMsg.BaseObject, ProcessMsg.nParam1,
                    ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                byte[] data = new byte[sizeof(TMessageBodyWL)];
                fixed (byte* pb = data)
                {
                    *(TMessageBodyW*)pb = MessageBodyW;
                }
                SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TMessageBodyW)));
            }
        }

        internal unsafe void ServerDigUp(TProcessMessage ProcessMsg, ref bool boResult)
        {
            TBaseObject BaseObject = HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject);
            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_DIGUP, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, HUtil32.MakeWord((byte)ProcessMsg.wParam,
                (byte)HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject).m_nLight), 0);
            TMessageBodyWL MessageBodyWL = new TMessageBodyWL();
            MessageBodyWL.lParam1 = BaseObject.GetFeature(this);
            MessageBodyWL.lParam2 = BaseObject.m_nCharStatus;
            MessageBodyWL.lTag1 = ProcessMsg.nParam3;
            MessageBodyWL.lTag1 = 0;
            byte[] datas = new byte[sizeof(TMessageBodyWL)];
            fixed (byte* pb = datas)
            {
                *(TMessageBodyWL*)pb = MessageBodyWL;
            }
            string s1C = EncryptUnit.EncodeBuffer(datas, sizeof(TMessageBodyWL));
            SendSocket(this.m_DefMsg, s1C);
        }

        /// <summary>
        /// 发送解包物品数据
        /// </summary>
        /// <param name="ProcessMsg"></param>
        /// <param name="boResult"></param>
        internal void ServerButch(TProcessMessage ProcessMsg, ref bool boResult)
        {
            if (ProcessMsg.BaseObject != 0)
            {
                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_BUTCH, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                SendSocket(this.m_DefMsg, "");
            }
        }

        internal void ServerDeath(TProcessMessage ProcessMsg, ref bool boResult)
        {
            if (ProcessMsg.nParam3 == 1)
            {
                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_NOWDEATH, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, 0);
            }
            else
            {
                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_DEATH, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, 0);
            }
            TCharDesc CharDesc = new TCharDesc();
            TBaseObject BaseObject = HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject);
            CharDesc.feature = BaseObject.GetFeature(this);
            CharDesc.Status = BaseObject.m_nCharStatus;
            unsafe
            {
                byte[] data = new byte[sizeof(TCharDesc)];
                fixed (byte* pb = data)
                {
                    *(TCharDesc*)pb = CharDesc;
                }
                SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TCharDesc)));
            }
        }

        internal void ServerSpell(TProcessMessage ProcessMsg, ref bool boResult)
        {
            if (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject) != this)
            {
                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SPELL, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                SendSocket(this.m_DefMsg, (ProcessMsg.nParam3).ToString());
            }
            else
            {
                if (HUtil32.rangeInDefined(ProcessMsg.nParam3, 60, 65) || HUtil32.rangeInDefined(ProcessMsg.nParam3, 76, 87))
                {
                    this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SPELL, ProcessMsg.BaseObject,
                  ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                    SendSocket(this.m_DefMsg, (ProcessMsg.nParam3).ToString());
                }
            }
        }

        /// <summary>
        /// 玩家属性
        /// </summary>
        /// <param name="ProcessMsg"></param>
        /// <param name="boResult"></param>
        internal unsafe void ServerAbilty(TProcessMessage ProcessMsg, ref bool boResult)
        {
            TOAbility* OAbility = null;
            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_ABILITY, this.m_nGold, HUtil32.MakeWord(this.m_btJob, 99), HUtil32.LoWord(m_nGameGold), HUtil32.HiWord(m_nGameGold), 0);
            if ((m_nSoftVersionDateEx == 0) && (m_dwClientTick == 0))
            {
                GetOldAbil(OAbility);
                SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(OAbility, sizeof(TOAbility)));
                if (GameConfig.boOldClientShowHiLevel && (this.m_Abil.Level > 255))// '由于您使用的客户端版本太老了，无法正确显示人物信息！！！'
                {
                    this.SysMsg(GameMsgDef.g_sClientVersionTooOld, TMsgColor.c_Red, TMsgType.t_Hint);
                    this.SysMsg("当前等级: " + this.m_Abil.Level, TMsgColor.c_Green, TMsgType.t_Hint);
                    this.SysMsg("当前生命值: " + this.m_WAbil.HP + "-" + this.m_WAbil.MaxHP, TMsgColor.c_Blue, TMsgType.t_Hint);
                    this.SysMsg("当前魔法值: " + this.m_WAbil.MP + "-" + this.m_WAbil.MaxMP, TMsgColor.c_Red, TMsgType.t_Hint);
                    this.SysMsg("当前防御力: " + HUtil32.LoWord(this.m_WAbil.AC) + "-" + HUtil32.HiWord(this.m_WAbil.AC), TMsgColor.c_Green, TMsgType.t_Hint);
                    this.SysMsg("当前魔防力: " + HUtil32.LoWord(this.m_WAbil.MAC) + "-" + HUtil32.HiWord(this.m_WAbil.MAC), TMsgColor.c_Blue, TMsgType.t_Hint);
                    this.SysMsg("当前攻击力: " + HUtil32.LoWord(this.m_WAbil.DC) + "-" + HUtil32.HiWord(this.m_WAbil.DC), TMsgColor.c_Red, TMsgType.t_Hint);
                    this.SysMsg("当前魔法力: " + HUtil32.LoWord(this.m_WAbil.MC) + "-" + HUtil32.HiWord(this.m_WAbil.MC), TMsgColor.c_Green, TMsgType.t_Hint);
                    this.SysMsg("当前道术值: " + HUtil32.LoWord(this.m_WAbil.SC) + "-" + HUtil32.HiWord(this.m_WAbil.SC), TMsgColor.c_Blue, TMsgType.t_Hint);
                }
            }
            else
            {
                byte[] data = new byte[sizeof(TAbility)];
                fixed (byte* pb = data)
                {
                    *(TAbility*)pb = this.m_WAbil;
                }
                SendSocket(this.m_DefMsg, data.EncodeBuffer());
            }

        }

        /// <summary>
        /// 玩家升级
        /// </summary>
        /// <param name="ProcessMsg"></param>
        /// <param name="boResult"></param>
        internal unsafe void ServerLevelUp(TProcessMessage ProcessMsg, ref bool boResult)
        {
            TOAbility* OAbility = null;
            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_LEVELUP, this.m_Abil.Exp, this.m_Abil.Level, 0, 0, 0);
            SendSocket(this.m_DefMsg, "");
            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_ABILITY, this.m_nGold, HUtil32.MakeWord(this.m_btJob, 99), HUtil32.LoWord(m_nGameGold),
                HUtil32.HiWord(m_nGameGold), 0);
            if ((m_nSoftVersionDateEx == 0) && (m_dwClientTick == 0))
            {
                GetOldAbil(OAbility);
                SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(OAbility, sizeof(TOAbility)));
            }
            else
            {
                byte[] data = new byte[sizeof(TAbility)];
                fixed (byte* pb = data)
                {
                    *(TAbility*)pb = this.m_WAbil;
                }
                SendSocket(this.m_DefMsg, data.EncodeBuffer());
            }
            SendDefMessage(Grobal2.SM_SUBABILITY, HUtil32.MakeLong(HUtil32.MakeWord((byte)this.m_nAntiMagic, 0), 0), HUtil32.MakeWord(this.m_btHitPoint, this.m_btSpeedPoint),
                HUtil32.MakeWord((byte)this.m_btAntiPoison, (byte)this.m_nPoisonRecover), HUtil32.MakeWord((byte)this.m_nHealthRecover, (byte)this.m_nSpellRecover), "");
        }

        internal void ServerRun(TProcessMessage ProcessMsg, ref bool boResult)
        {
            TBaseObject BaseObject = HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject);
            if (BaseObject != this)
            {
                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_RUN, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, HUtil32.MakeWord((byte)ProcessMsg.wParam,
                    (byte)BaseObject.m_nLight), 0);
                TCharDesc CharDesc = new TCharDesc();
                CharDesc.feature = BaseObject.GetFeature(BaseObject);
                CharDesc.Status = BaseObject.m_nCharStatus;
                unsafe
                {
                    byte[] data = new byte[sizeof(TCharDesc)];
                    fixed (byte* pb = data)
                    {
                        *(TCharDesc*)pb = CharDesc;
                    }
                    SendSocket(this.m_DefMsg, data.EncodeBuffer());
                }
            }
        }

        internal void ServerHorseRun(TProcessMessage ProcessMsg, ref bool boResult)
        {
            TBaseObject BaseObject = HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject);
            if (BaseObject != this)
            {
                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_HORSERUN, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, HUtil32.MakeWord((byte)ProcessMsg.wParam,
                    (byte)BaseObject.m_nLight), 0);
                TCharDesc CharDesc = new TCharDesc();
                CharDesc.feature = BaseObject.GetFeature(BaseObject);
                CharDesc.Status = BaseObject.m_nCharStatus;
                unsafe
                {
                    byte[] data = new byte[sizeof(TCharDesc)];
                    fixed (byte* pb = data)
                    {
                        *(TCharDesc*)pb = CharDesc;
                    }
                    SendSocket(this.m_DefMsg, data.EncodeBuffer());
                }
            }
        }

        internal void ServerWalk(TProcessMessage ProcessMsg, ref bool boResult)
        {
            TBaseObject BaseObject = HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject);
            if (BaseObject != this)
            {
                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_WALK, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, HUtil32.MakeWord((byte)ProcessMsg.wParam,
                    (byte)BaseObject.m_btJob), 0);
                TCharDesc CharDesc = new TCharDesc();
                CharDesc.feature = BaseObject.GetFeature(BaseObject);
                CharDesc.Status = BaseObject.m_nCharStatus;
                unsafe
                {
                    byte[] data = new byte[sizeof(TCharDesc)];
                    fixed (byte* pb = data)
                    {
                        *(TCharDesc*)pb = CharDesc;
                    }
                    SendSocket(this.m_DefMsg, data.EncodeBuffer());
                }
            }
        }

        /// <summary>
        /// 蹲下？
        /// </summary>
        /// <param name="ProcessMsg"></param>
        /// <param name="boResult"></param>
        internal unsafe void ClientSitDown(TProcessMessage ProcessMsg, ref bool boResult)
        {
            uint dwDelayTime = 0;
            int nMsgCount = 0;
            if (ClientSitDownHit(ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, ref dwDelayTime))
            {
                m_dwActionTick = HUtil32.GetTickCount();
                SendSocket(null, M2Share.sSTATUS_GOOD);
                SendSocket(null, M2Share.sSTATUS_GOOD);
            }
            else
            {
                if (dwDelayTime == 0)
                {
                    SendSocket(null, M2Share.sSTATUS_FAIL);
                }
                else
                {
                    nMsgCount = GetSiteDownMsgCount();
                    if (nMsgCount >= GameConfig.nMaxSitDonwMsgCount)
                    {
                        m_nOverSpeedCount++;
                        if (m_nOverSpeedCount > GameConfig.nOverSpeedKickCount)
                        {
                            if (GameConfig.boKickOverSpeed)
                            {
                                // '请勿使用非法软件！！！'
                                this.SysMsg(GameMsgDef.g_sKickClientUserMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                                m_boEmergencyClose = true;
                                m_boPlayOffLine = false;
                            }
                            if (GameConfig.boViewHackMessage)
                            {
                                M2Share.MainOutMessage(string.Format(GameMsgDef.g_sBunOverSpeed, this.m_sCharName, dwDelayTime, nMsgCount));
                            }
                        }
                        // 如果超速则发送攻击失败信息
                        SendSocket(null, M2Share.sSTATUS_FAIL);
                    }
                    else
                    {
                        if (dwDelayTime < GameConfig.dwDropOverSpeed)
                        {
                            SendSocket(null, M2Share.sSTATUS_GOOD);
                            if (m_boTestSpeedMode)
                            {
                                this.SysMsg(string.Format("速度异常 Ident: {0} Time: {1}", ProcessMsg.wIdent, dwDelayTime), TMsgColor.c_Red, TMsgType.t_Hint);
                            }
                        }
                        else
                        {
                            if (m_boTestSpeedMode)
                            {
                                this.SysMsg(string.Format("操作延迟 Ident: {0} Time: {1}", ProcessMsg.wIdent, dwDelayTime), TMsgColor.c_Red, TMsgType.t_Hint);
                            }
                            this.SendDelayMsg(this, ProcessMsg.wIdent, ProcessMsg.wParam, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, "", dwDelayTime);
                            boResult = false;
                        }
                    }
                }
            }

        }

        /// <summary>
        /// 骑马攻击
        /// </summary>
        /// <param name="ProcessMsg"></param>
        /// <param name="boResult"></param>
        internal unsafe void ClientHorseRun(TProcessMessage ProcessMsg, ref bool boResult)
        {
            uint dwDelayTime = 0;
            int nMsgCount = 0;
            if (ClientHorseRunXY(ProcessMsg.wIdent, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.boLateDelivery, ref dwDelayTime))
            {
                m_dwActionTick = HUtil32.GetTickCount();
                SendSocket(null, M2Share.sSTATUS_GOOD);
            }
            else
            {
                if (dwDelayTime == 0)
                {
                    SendSocket(null, M2Share.sSTATUS_FAIL);
                }
                else
                {
                    nMsgCount = GetRunMsgCount();
                    if (nMsgCount >= GameConfig.nMaxRunMsgCount)
                    {
                        m_nOverSpeedCount++;
                        if (m_nOverSpeedCount > GameConfig.nOverSpeedKickCount)
                        {
                            if (GameConfig.boKickOverSpeed)
                            {
                                this.SysMsg(GameMsgDef.g_sKickClientUserMsg, TMsgColor.c_Red, TMsgType.t_Hint); // '请勿使用非法软件！！！'
                                m_boEmergencyClose = true;
                                m_boPlayOffLine = false;
                            }
                            if (GameConfig.boViewHackMessage)
                            {
                                M2Share.MainOutMessage(string.Format(GameMsgDef.g_sRunOverSpeed, this.m_sCharName, dwDelayTime, nMsgCount));
                            }
                        }
                        // 如果超速则发送攻击失败信息
                        SendSocket(null, M2Share.sSTATUS_FAIL);
                        if (m_boTestSpeedMode)
                        {
                            this.SysMsg(string.Format("速度异常 Ident: {0} Time: {1}", ProcessMsg.wIdent, dwDelayTime), TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                    }
                    else
                    {
                        if (m_boTestSpeedMode)
                        {
                            this.SysMsg(string.Format("操作延迟 Ident: {0} Time: {1}", ProcessMsg.wIdent, dwDelayTime), TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                        this.SendDelayMsg(this, ProcessMsg.wIdent, ProcessMsg.wParam, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, "", dwDelayTime);
                        boResult = false;
                    }
                }
            }
        }

        /// <summary>
        /// 挖取物品
        /// </summary>
        /// <param name="ProcessMsg"></param>
        /// <param name="boResult"></param>
        internal unsafe void ClientButch(TProcessMessage ProcessMsg, ref bool boResult)
        {
            uint dwDelayTime = 0;
            int nMsgCount = 0;
            if (!ClientGetButchItem(HUtil32.IntToObject<TBaseObject>(ProcessMsg.nParam1), ProcessMsg.nParam2, ProcessMsg.nParam3, (byte)ProcessMsg.wParam, ref dwDelayTime))
            {
                if (dwDelayTime != 0)
                {
                    nMsgCount = GetDigUpMsgCount();
                    if (nMsgCount >= GameConfig.nMaxDigUpMsgCount)// 越过M2的挖肉限制数量
                    {
                        m_nOverSpeedCount++;
                        if (m_nOverSpeedCount > GameConfig.nOverSpeedKickCount)
                        {
                            if (GameConfig.boKickOverSpeed)
                            {
                                this.SysMsg(GameMsgDef.g_sKickClientUserMsg, TMsgColor.c_Red, TMsgType.t_Hint); // '请勿使用非法软件！！！'
                                m_boEmergencyClose = true;
                                m_boPlayOffLine = false;
                            }
                            if (GameConfig.boViewHackMessage)
                            {
                                M2Share.MainOutMessage(string.Format(GameMsgDef.g_sBunOverSpeed, this.m_sCharName, dwDelayTime, nMsgCount));
                            }
                        }
                        SendSocket(null, M2Share.sSTATUS_FAIL);// 如果超速则发送攻击失败信息
                    }
                    else
                    {
                        if (dwDelayTime < GameConfig.dwDropOverSpeed)
                        {
                            if (m_boTestSpeedMode)
                            {
                                this.SysMsg(string.Format("速度异常 Ident: {0} Time: {1}", ProcessMsg.wIdent, dwDelayTime), TMsgColor.c_Red, TMsgType.t_Hint);
                            }
                            SendSocket(null, M2Share.sSTATUS_GOOD);
                        }
                        else
                        {
                            this.SendDelayMsg(this, ProcessMsg.wIdent, ProcessMsg.wParam, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, "", dwDelayTime);
                            boResult = false;
                        }
                    }
                }
            }
        }

        /// <summary>
        /// 移动？
        /// </summary>
        /// <param name="ProcessMsg"></param>
        /// <param name="boResult"></param>
        internal void ServerSpaceMoveShow(TProcessMessage ProcessMsg, ref bool boResult)
        {
            TBaseObject BaseObject = HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject);
            if (ProcessMsg.wIdent == Grobal2.RM_SPACEMOVE_SHOW)
            {
                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SPACEMOVE_SHOW, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2,
                    HUtil32.MakeWord((byte)ProcessMsg.wParam, (byte)BaseObject.m_nLight), 0);
            }
            else
            {
                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SPACEMOVE_SHOW2, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2,
                    HUtil32.MakeWord((byte)ProcessMsg.wParam, (byte)BaseObject.m_nLight), 0);
            }
            TCharDesc CharDesc = new TCharDesc();
            CharDesc.feature = BaseObject.GetFeature(this);
            CharDesc.Status = BaseObject.m_nCharStatus;
            unsafe
            {
                byte[] data = new byte[sizeof(TCharDesc)];
                fixed (byte* pb = data)
                {
                    *(TCharDesc*)pb = CharDesc;
                }
                string s1C = EncryptUnit.EncodeBuffer(data, sizeof(TCharDesc));
                int nObjCount = this.GetCharColor(BaseObject);
                if (ProcessMsg.sMsg != null && ProcessMsg.sMsg != "")
                {
                    s1C = s1C + EncryptUnit.EncodeString(ProcessMsg.sMsg + "/" + (nObjCount).ToString());
                }
                SendSocket(this.m_DefMsg, s1C);
            }
        }

        /// <summary>
        /// 使用技能
        /// </summary>
        /// <param name="ProcessMsg"></param>
        /// <param name="boResult"></param>
        internal unsafe void ClientSpell(TProcessMessage ProcessMsg, ref bool boResult)
        {
            uint dwDelayTime = 0;
            int nMsgCount = 0;
            if (ClientSpellXY((ushort)ProcessMsg.wIdent, ProcessMsg.wParam, ProcessMsg.nParam1, ProcessMsg.nParam2,
                HUtil32.IntToObject<TBaseObject>(ProcessMsg.nParam3), ProcessMsg.boLateDelivery, ref dwDelayTime))
            {
                m_dwActionTick = HUtil32.GetTickCount();
                SendSocket(null, M2Share.sSTATUS_GOOD);
            }
            else
            {
                if (dwDelayTime == 0)
                {
                    SendSocket(null, M2Share.sSTATUS_FAIL);
                }
                else
                {
                    nMsgCount = GetSpellMsgCount();
                    if (nMsgCount >= GameConfig.nMaxSpellMsgCount)
                    {
                        m_nOverSpeedCount++;
                        if (m_nOverSpeedCount > GameConfig.nOverSpeedKickCount)
                        {
                            if (GameConfig.boKickOverSpeed)
                            {
                                this.SysMsg(GameMsgDef.g_sKickClientUserMsg, TMsgColor.c_Red, TMsgType.t_Hint); // '请勿使用非法软件！！！'
                                m_boEmergencyClose = true;
                                m_boPlayOffLine = false;
                            }
                            if (GameConfig.boViewHackMessage) // 如果超速则发送攻击失败信息
                            {
                                M2Share.MainOutMessage(string.Format(GameMsgDef.g_sSpellOverSpeed, this.m_sCharName, dwDelayTime, nMsgCount));
                            }
                        }
                        SendSocket(null, M2Share.sSTATUS_FAIL);
                    }
                    else
                    {
                        if ((dwDelayTime > GameConfig.dwDropOverSpeed) && (GameConfig.btSpeedControlMode == 1) && m_boFilterAction)
                        {
                            SendSocket(null, M2Share.sSTATUS_FAIL);
                            if (m_boTestSpeedMode)
                            {
                                this.SysMsg(string.Format("速度异常 Ident: {0} Time: {1}", ProcessMsg.wIdent, dwDelayTime), TMsgColor.c_Red, TMsgType.t_Hint);
                            }
                        }
                        else
                        {
                            if (m_boTestSpeedMode)
                            {
                                this.SysMsg(string.Format("操作延迟 Ident: {0} Time: {1}", ProcessMsg.wIdent, dwDelayTime), TMsgColor.c_Red, TMsgType.t_Hint);
                            }
                            this.SendDelayMsg(this, ProcessMsg.wIdent, ProcessMsg.wParam, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, "", dwDelayTime);
                            boResult = false;
                        }
                    }
                }
            }
        }

        /// <summary>
        /// 切换地图
        /// </summary>
        /// <param name="ProcessMsg"></param>
        /// <param name="boResult"></param>
        internal void ServerChangeMap(TProcessMessage ProcessMsg, ref bool boResult)
        {
            int nObjCount = -1;
            if (this.m_PEnvir.m_boDARK)
            {
                nObjCount = 1;
            }
            else
            {
                switch (m_nBright)
                {
                    case 1:
                        nObjCount = 0;
                        break;
                    case 3:
                        nObjCount = 1;
                        break;
                    default:
                        nObjCount = 1;
                        break;
                }
            }
            if (this.m_PEnvir.m_boDAY)
            {
                nObjCount = 0;
            }
            SendDefMessage(Grobal2.SM_CHANGEMAP, this.ToInt(), this.m_nCurrX, this.m_nCurrY, nObjCount, ProcessMsg.sMsg);
            RefUserState();
            SendMapDescription();
            SendServerConfig();// 发送服务端配置
            SendUnBind();
        }

        /// <summary>
        /// 登录游戏
        /// </summary>
        /// <param name="ProcessMsg"></param>
        /// <param name="boResult"></param>
        internal void ServerLogon(TProcessMessage ProcessMsg, ref bool boResult)
        {
            int nObjCount = -1;
            if (this.m_PEnvir.m_boDARK)
            {
                nObjCount = 1;
            }
            else
            {
                switch (m_nBright)
                {
                    case 1:
                        nObjCount = 0;
                        break;
                    case 3:
                        nObjCount = 1;
                        break;
                    default:
                        nObjCount = 1;
                        break;
                }
            }
            if (this.m_PEnvir.m_boDAY)
            {
                nObjCount = 0;
            }
            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_NEWMAP, this.ToInt(), this.m_nCurrX, this.m_nCurrY, nObjCount, 0);
            SendSocket(this.m_DefMsg, EncryptUnit.EncodeString(M2Share.g_MapManager.GetMainMap(this.m_PEnvir)));
            this.SendMsg(this, Grobal2.RM_CHANGELIGHT, 0, 0, 0, 0, "");
            SendLogon();
            SendServerConfig();//发送服务器配置文件（比如穿怪 穿人等）
            SendUnBind();// 发送解包文件
            ClientQueryUserName(this, this.m_nCurrX, this.m_nCurrY);
            RefUserState();// 地图状态
            SendMapDescription();
            SendGoldInfo(true);
            SendGloryInfo();
            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_VERSION_FAIL, GameConfig.nClientFile1_CRC, 0, 0, 0, 0);// 验证客户端版本 
            SendSocket(this.m_DefMsg, "");
        }

        /// <summary>
        /// 系统公告
        /// </summary>
        /// <param name="ProcessMsg"></param>
        /// <param name="boResult"></param>
        internal void ServerSay(TProcessMessage ProcessMsg, ref bool boResult)
        {
            switch (ProcessMsg.wIdent)
            {
                case Grobal2.RM_HEAR:
                    this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_HEAR, ProcessMsg.BaseObject, HUtil32.MakeWord((byte)ProcessMsg.nParam1, (byte)ProcessMsg.nParam2), 0, 1, 0);
                    break;
                case Grobal2.RM_WHISPER:// 10030
                    this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_WHISPER, ProcessMsg.BaseObject, HUtil32.MakeWord((byte)ProcessMsg.nParam1, (byte)ProcessMsg.nParam2), 0, 1, 0);
                    break;
                case Grobal2.RM_CRY:// 10031
                    this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_CRY, ProcessMsg.BaseObject, HUtil32.MakeWord((byte)ProcessMsg.nParam1, (byte)ProcessMsg.nParam2), 0, 1, 0);
                    break;
                case Grobal2.RM_SYSMESSAGE:// 10032
                    this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SYSMESSAGE, ProcessMsg.BaseObject, HUtil32.MakeWord((byte)ProcessMsg.nParam1, (byte)ProcessMsg.nParam2), 0, 1, 0);
                    break;
                case Grobal2.RM_MOVEMESSAGE:// 10100 红色 消息分类
                    this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_MOVEMESSAGE, ProcessMsg.BaseObject, HUtil32.MakeWord((byte)ProcessMsg.nParam1,
                        (byte)ProcessMsg.nParam2), ProcessMsg.nParam3, ProcessMsg.wParam, 0);
                    break;
                case Grobal2.RM_GROUPMESSAGE:// 10100 红色  
                    this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SYSMESSAGE, ProcessMsg.BaseObject, HUtil32.MakeWord((byte)ProcessMsg.nParam1, (byte)ProcessMsg.nParam2), 0, 1, 0);
                    break;
                case Grobal2.RM_GUILDMESSAGE://10102
                    this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_GUILDMESSAGE, ProcessMsg.BaseObject, HUtil32.MakeWord((byte)ProcessMsg.nParam1, (byte)ProcessMsg.nParam2), 0, 1, 0);
                    break;
                case Grobal2.RM_MERCHANTSAY://10104 行会聊天
                    this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_MERCHANTSAY, ProcessMsg.BaseObject, HUtil32.MakeWord((byte)ProcessMsg.nParam1, (byte)ProcessMsg.nParam2), 0, 1, 0);
                    break;
                case Grobal2.RM_PLAYDRINKSAY://10126
                    this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_PLAYDRINKSAY, ProcessMsg.BaseObject, ProcessMsg.nParam3, 0, 1, 0);
                    break;
            }
            SendSocket(this.m_DefMsg, EncryptUnit.EncodeString(ProcessMsg.sMsg));
        }

        /// <summary>
        ///  英雄转身 人物转身
        /// </summary>
        /// <param name="ProcessMsg"></param>
        /// <param name="boResult"></param>
        internal void ServerTurn(TProcessMessage ProcessMsg, ref bool boResult)
        {
            int nCode = 152;
            TBaseObject BaseObject = HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject);
            if (((BaseObject != this) || (ProcessMsg.wIdent == Grobal2.RM_PUSH) ||
                (ProcessMsg.wIdent == Grobal2.RM_RUSH) || (ProcessMsg.wIdent == Grobal2.RM_RUSHKUNG) || (ProcessMsg.wIdent == Grobal2.RM_CHANGETURN)))
            {
                switch (ProcessMsg.wIdent)
                {
                    case Grobal2.RM_PUSH:
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_BACKSTEP, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, HUtil32.MakeWord((byte)ProcessMsg.wParam,
                            (byte)BaseObject.m_nLight), 0);
                        break;
                    case Grobal2.RM_PUSHEX:
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_BATTERBACKSTEP, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, HUtil32.MakeWord((byte)ProcessMsg.wParam,
                            (byte)BaseObject.m_nLight), 0);
                        break;
                    case Grobal2.RM_RUSH:
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_RUSH, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, HUtil32.MakeWord((byte)ProcessMsg.wParam,
                            (byte)BaseObject.m_nLight), 0);
                        break;
                    case Grobal2.RM_RUSHKUNG:// 攻杀
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_RUSHKUNG, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, HUtil32.MakeWord((byte)ProcessMsg.wParam,
                            (byte)BaseObject.m_nLight), 0);
                        break;
                    default://这里发送消息给客户端绘制NPC
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_TURN, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, HUtil32.MakeWord((byte)ProcessMsg.wParam,
                            (byte)BaseObject.m_nLight), 0);
                        break;
                }
                TCharDesc CharDesc = new TCharDesc();
                CharDesc.feature = BaseObject.GetFeature(BaseObject);
                CharDesc.Status = BaseObject.m_nCharStatus;
                unsafe
                {
                    byte[] data = new byte[sizeof(TCharDesc)];
                    fixed (byte* pb = data)
                    {
                        *(TCharDesc*)pb = CharDesc;
                    }
                    string s1C = data.EncodeBuffer();
                    int nObjCount = this.GetCharColor(BaseObject);// 取人物名字颜色
                    if (ProcessMsg.sMsg != null && ProcessMsg.sMsg != "")
                    {
                        s1C = s1C + EncryptUnit.EncodeString(ProcessMsg.sMsg + "/" + nObjCount);
                    }
                    SendSocket(this.m_DefMsg, s1C);
                    if (ProcessMsg.wIdent == Grobal2.RM_TURN)
                    {
                        nObjCount = BaseObject.GetFeatureToLong();
                        SendDefMessage(Grobal2.SM_FEATURECHANGED, ProcessMsg.BaseObject, HUtil32.LoWord(nObjCount), HUtil32.HiWord(nObjCount), BaseObject.GetFeatureEx(), "");
                    }
                }
            }
        }

        /// <summary>
        /// 攻击目标
        /// </summary>
        /// <param name="ProcessMsg"></param>
        /// <param name="boResult"></param>
        internal unsafe void ClientAttack(TProcessMessage ProcessMsg, ref bool boResult)
        {
            // 开天斩重击// 开天斩轻击// 龙影剑法// 逐日剑法// 烈火// 4级烈火
            // 三绝杀// 追心刺// 断岳斩// 横扫千军// 倚天劈地// 血魄一击// 4级刺杀// 圆月弯刀
            int nCode = 124;
            uint dwDelayTime = 0;
            int nMsgCount = 0;
            if (ClientHitXY(ProcessMsg.wIdent, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, ProcessMsg.boLateDelivery, ref dwDelayTime))
            {
                m_dwActionTick = HUtil32.GetTickCount();
                SendSocket(null, M2Share.sSTATUS_GOOD);
            }
            else
            {
                if (dwDelayTime == 0)
                {
                    SendSocket(null, M2Share.sSTATUS_FAIL);
                }
                else
                {
                    nMsgCount = GetHitMsgCount();
                    if (nMsgCount >= GameConfig.nMaxHitMsgCount)
                    {
                        m_nOverSpeedCount++;
                        if (m_nOverSpeedCount > GameConfig.nOverSpeedKickCount)
                        {
                            if (GameConfig.boKickOverSpeed)
                            {
                                // '请勿使用非法软件！！！'
                                this.SysMsg(GameMsgDef.g_sKickClientUserMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                                m_boEmergencyClose = true;
                                m_boPlayOffLine = false;
                            }
                            if (GameConfig.boViewHackMessage)
                            {
                                M2Share.MainOutMessage(string.Format(GameMsgDef.g_sHitOverSpeed, this.m_sCharName, dwDelayTime, nMsgCount));
                            }
                        }
                        // 如果超速则发送攻击失败信息
                        SendSocket(null, M2Share.sSTATUS_FAIL);
                    }
                    else
                    {
                        if ((dwDelayTime > GameConfig.dwDropOverSpeed) && (GameConfig.btSpeedControlMode == 1) && m_boFilterAction)
                        {
                            SendSocket(null, M2Share.sSTATUS_GOOD);
                            if (m_boTestSpeedMode)
                            {
                                this.SysMsg(string.Format("速度异常 Ident: {0} Time: {1}", ProcessMsg.wIdent, dwDelayTime), TMsgColor.c_Red, TMsgType.t_Hint);
                            }
                        }
                        else
                        {
                            if (m_boTestSpeedMode)
                            {
                                this.SysMsg("操作延迟 Ident: " + ProcessMsg.wIdent + " Time: " + dwDelayTime, TMsgColor.c_Red, TMsgType.t_Hint);
                            }
                            this.SendDelayMsg(this, ProcessMsg.wIdent, ProcessMsg.wParam, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, "", dwDelayTime);
                            boResult = false;
                        }
                    }
                }
            }
        }

        internal unsafe void ClientRun(TProcessMessage ProcessMsg, ref bool boResult)
        {
            int nCode = 123;
            uint dwDelayTime = 0;
            int nMsgCount = 0;
            if (ClientRunXY(ProcessMsg.wIdent, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, ref dwDelayTime))
            {
                m_dwActionTick = HUtil32.GetTickCount();
                if (GameConfig.boStartMapEvent)
                {
                    if (this.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                    {
                        StartMapEventOfRun(); // 跑步事件触发
                    }
                }
                SendSocket(null, M2Share.sSTATUS_GOOD);
            }
            else
            {
                if (dwDelayTime == 0)
                {
                    SendSocket(null, M2Share.sSTATUS_FAIL);
                }
                else
                {
                    nMsgCount = GetRunMsgCount();
                    if (nMsgCount >= GameConfig.nMaxRunMsgCount)
                    {
                        m_nOverSpeedCount++;
                        if (m_nOverSpeedCount > GameConfig.nOverSpeedKickCount)
                        {
                            if (GameConfig.boKickOverSpeed)
                            {
                                this.SysMsg(GameMsgDef.g_sKickClientUserMsg, TMsgColor.c_Red, TMsgType.t_Hint);// '请勿使用非法软件！！！'
                                m_boEmergencyClose = true;
                                m_boPlayOffLine = false;
                            }
                            if (GameConfig.boViewHackMessage)
                            {
                                M2Share.MainOutMessage(string.Format(GameMsgDef.g_sRunOverSpeed, this.m_sCharName, dwDelayTime, nMsgCount));
                            }
                        }
                        // 如果超速则发送攻击失败信息
                        SendSocket(null, M2Share.sSTATUS_FAIL);
                    }
                    else
                    {
                        if ((dwDelayTime > GameConfig.dwDropOverSpeed) && (GameConfig.btSpeedControlMode == 1) && m_boFilterAction)
                        {
                            SendSocket(null, M2Share.sSTATUS_FAIL);
                            if (m_boTestSpeedMode)
                            {
                                this.SysMsg(string.Format("速度异常 Ident: {0} Time: {1}", ProcessMsg.wIdent, dwDelayTime), TMsgColor.c_Red, TMsgType.t_Hint);
                            }
                        }
                        else
                        {
                            if (m_boTestSpeedMode)
                            {
                                this.SysMsg(string.Format("操作延迟 Ident: {0} Time: {1}", ProcessMsg.wIdent, dwDelayTime), TMsgColor.c_Red, TMsgType.t_Hint);
                            }
                            this.SendDelayMsg(this, ProcessMsg.wIdent, ProcessMsg.wParam, ProcessMsg.nParam1, ProcessMsg.nParam2, Grobal2.CM_RUN, "", dwDelayTime);
                            boResult = false;
                        }
                    }
                }
            }
        }

        /// <summary>
        /// 转向
        /// </summary>
        /// <param name="ProcessMsg"></param>
        /// <param name="boResult"></param>
        internal unsafe void ClientTurn(TProcessMessage ProcessMsg, ref bool boResult)
        {
            int nCode = 120;
            uint dwDelayTime = 0;
            int nMsgCount = 0;
            if (ClientChangeDir(ProcessMsg.wIdent, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, ref dwDelayTime))
            {
                m_dwActionTick = HUtil32.GetTickCount();
                SendSocket(null, M2Share.sSTATUS_GOOD);
            }
            else
            {
                if (dwDelayTime == 0)
                {
                    SendSocket(null, M2Share.sSTATUS_FAIL);
                }
                else
                {
                    nMsgCount = GetTurnMsgCount();
                    if (nMsgCount >= GameConfig.nMaxTurnMsgCount)
                    {
                        m_nOverSpeedCount++;
                        if (m_nOverSpeedCount > GameConfig.nOverSpeedKickCount)
                        {
                            if (GameConfig.boKickOverSpeed)
                            {
                                this.SysMsg(GameMsgDef.g_sKickClientUserMsg, TMsgColor.c_Red, TMsgType.t_Hint);// '请勿使用非法软件！！！'
                                m_boEmergencyClose = true;
                                m_boPlayOffLine = false;
                            }
                            if (GameConfig.boViewHackMessage) // 如果超速则发送攻击失败信息
                            {
                                M2Share.MainOutMessage(string.Format(GameMsgDef.g_sBunOverSpeed, this.m_sCharName, dwDelayTime, nMsgCount));
                            }
                        }
                        SendSocket(null, M2Share.sSTATUS_FAIL);
                    }
                    else
                    {
                        if (dwDelayTime < GameConfig.dwDropOverSpeed)
                        {
                            SendSocket(null, M2Share.sSTATUS_GOOD);
                            if (m_boTestSpeedMode)
                            {
                                this.SysMsg(string.Format("速度异常 Ident: {0} Time: {1}", ProcessMsg.wIdent, dwDelayTime), TMsgColor.c_Red, TMsgType.t_Hint);
                            }
                        }
                        else
                        {
                            this.SendDelayMsg(this, ProcessMsg.wIdent, ProcessMsg.wParam, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, "", dwDelayTime);
                            boResult = false;
                        }
                    }
                }
            }
        }

        /// <summary>
        /// 走路
        /// </summary>
        /// <param name="ProcessMsg"></param>
        /// <param name="boResult"></param>
        internal unsafe void ClientWalk(TProcessMessage ProcessMsg, ref bool boResult)
        {
            int nCode = 121;
            uint dwDelayTime = 0;
            int nMsgCount = 0;
            if (ClientWalkXY(ProcessMsg.wIdent, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.boLateDelivery, ref dwDelayTime))
            {
                m_dwActionTick = HUtil32.GetTickCount();
                if (GameConfig.boStartMapEvent) // 开启地图事件触发
                {
                    if (this.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                    {
                        StartMapEventOfWalk(); // 走路事件触发
                    }
                }
                SendSocket(null, M2Share.sSTATUS_GOOD);
            }
            else
            {
                if (dwDelayTime == 0)
                {
                    SendSocket(null, M2Share.sSTATUS_FAIL);
                }
                else
                {
                    nMsgCount = GetWalkMsgCount();
                    if (nMsgCount >= GameConfig.nMaxWalkMsgCount)
                    {
                        m_nOverSpeedCount++;
                        if (m_nOverSpeedCount > GameConfig.nOverSpeedKickCount)
                        {
                            if (GameConfig.boKickOverSpeed)
                            {
                                this.SysMsg(GameMsgDef.g_sKickClientUserMsg, TMsgColor.c_Red, TMsgType.t_Hint);// '请勿使用非法软件！！！'
                                m_boEmergencyClose = true;
                                m_boPlayOffLine = false;
                            }
                            if (GameConfig.boViewHackMessage)
                            {
                                M2Share.MainOutMessage(string.Format(GameMsgDef.g_sWalkOverSpeed, this.m_sCharName, dwDelayTime, nMsgCount));
                            }
                        }
                        SendSocket(null, M2Share.sSTATUS_FAIL); // 如果超速则发送攻击失败信息
                        if (m_boTestSpeedMode)
                        {
                            this.SysMsg(string.Format("速度异常 Ident: {0} Time: {0}", ProcessMsg.wIdent, dwDelayTime), TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                    }
                    else
                    {
                        if ((dwDelayTime > GameConfig.dwDropOverSpeed) && (GameConfig.btSpeedControlMode == 1) && m_boFilterAction)
                        {
                            SendSocket(null, M2Share.sSTATUS_FAIL);
                            if (m_boTestSpeedMode)
                            {
                                this.SysMsg(string.Format("速度异常 Ident: {0} Time: {0}", ProcessMsg.wIdent, dwDelayTime), TMsgColor.c_Red, TMsgType.t_Hint);
                            }
                        }
                        else
                        {
                            if (m_boTestSpeedMode)
                            {
                                this.SysMsg(string.Format("操作延迟 Ident: {0} Time: {1}", ProcessMsg.wIdent, dwDelayTime), TMsgColor.c_Red, TMsgType.t_Hint);
                            }
                            this.SendDelayMsg(this, ProcessMsg.wIdent, ProcessMsg.wParam, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, "", dwDelayTime);
                            boResult = false;
                        }
                    }
                }
            }
        }

        /// <summary>
        /// 被攻击
        /// </summary>
        /// <param name="ProcessMsg"></param>
        /// <param name="boResult"></param>
        internal void ServerStruck(TProcessMessage ProcessMsg, ref bool boResult)
        {
            int nCode = 0;
            if (ProcessMsg.wParam > 0)
            {
                nCode = 275;
                TBaseObject BaseObject = HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject);
                if (BaseObject != null)
                {
                    nCode = 288;
                    if (BaseObject == this)
                    {
                        nCode = 289;
                        TBaseObject TagBaseObject = HUtil32.IntToObject<TBaseObject>(ProcessMsg.nParam3);
                        if (TagBaseObject != null)
                        {
                            nCode = 291;
                            if (!TagBaseObject.m_boDeath)
                            {
                                nCode = 292;
                                if ((TagBaseObject.m_btRaceServer == Grobal2.RC_PLAYOBJECT) || (TagBaseObject.m_btRaceServer == Grobal2.RC_HEROOBJECT))
                                {
                                    nCode = 154;
                                    this.SetPKFlag(TagBaseObject); //英雄灰色
                                }
                                nCode = 155;
                                this.SetLastHiter(TagBaseObject);
                            }
                        }
                        if ((M2Share.g_CastleManager.IsCastleMember(this) != null) && (TagBaseObject != null))
                        {
                            TagBaseObject.bo2B0 = true;
                            TagBaseObject.m_dw2B4Tick = HUtil32.GetTickCount();
                        }
                        this.m_nHealthTick = 0;
                        this.m_nSpellTick = 0;
                        this.m_nPerHealth -= 1;
                        this.m_nPerSpell -= 1;
                        this.m_dwStruckTick = HUtil32.GetTickCount();
                    }
                }
                nCode = 276;
                BaseObject = HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject);
                if (BaseObject != null)
                {
                    if (((BaseObject == this) && (GameConfig.boDisableSelfStruck)) ||
                        ((BaseObject.m_btRaceServer == Grobal2.RC_PLAYOBJECT) && GameConfig.boDisableStruck))
                    {
                        nCode = 278;
                        BaseObject.SendRefMsg(Grobal2.RM_HEALTHSPELLCHANGED, 0, 0, 0, 0, "");// 人物受打击无弯腰动作
                    }
                    else
                    {
                        nCode = 279;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_STRUCK, ProcessMsg.BaseObject, BaseObject.m_WAbil.HP,
                            BaseObject.m_WAbil.MaxHP, ProcessMsg.wParam, 0);
                        nCode = 280;
                        TMessageBodyWL MessageBodyWL;
                        MessageBodyWL.lParam1 = BaseObject.GetFeature(this);
                        nCode = 281;
                        MessageBodyWL.lParam2 = BaseObject.m_nCharStatus;
                        nCode = 282;
                        MessageBodyWL.lTag1 = ProcessMsg.nParam3;
                        nCode = 283;
                        if (ProcessMsg.wIdent == Grobal2.RM_STRUCK_MAG)
                        {
                            MessageBodyWL.lTag2 = 1;
                        }
                        else
                        {
                            MessageBodyWL.lTag2 = 0;
                        }
                        nCode = 284;
                        unsafe
                        {
                            byte[] data = new byte[sizeof(TMessageBodyWL)];
                            fixed (byte* pb = data)
                            {
                                *(TMessageBodyWL*)pb = MessageBodyWL;
                            }
                            SendSocket(this.m_DefMsg, data.EncodeBuffer());
                        }
                    }
                }
            }
        }

        public bool ClientPickUpItem_IsSelf(TBaseObject BaseObject)
        {
            bool result;
            if ((BaseObject == null) || (this == BaseObject))
            {
                result = true;
            }
            else
            {
                result = false;
            }
            return result;
        }

        public bool ClientPickUpItem_IsOfGroup(TBaseObject BaseObject)
        {
            bool result = false;
            TBaseObject GroupMember;
            if (m_GroupOwner == null)
            {
                return result;
            }
            for (int I = 0; I < m_GroupOwner.m_GroupMembers.Count; I++)
            {
                GroupMember = m_GroupOwner.m_GroupMembers[I];
                if (GroupMember == BaseObject)
                {
                    result = true;
                    break;
                }
            }
            return result;
        }

        /// <summary>
        /// 玩家捡起物品
        /// </summary>
        /// <returns></returns>
        private unsafe bool ClientPickUpItem()
        {
            bool result = false;
            TUserItem* UserItem;
            TMapItem MapItem;
            TStdItem* StdItem;
            TPlayObject PlayObject;
            if (m_boDealing)
            {
                return result;// 交易中则退出
            }
            if (this.m_boDeath)
            {
                return result; // 死亡则退出
            }
            MapItem = this.m_PEnvir.GetItem(this.m_nCurrX, this.m_nCurrY);
            if (MapItem == null)
            {
                return result;
            }
            if ((HUtil32.GetTickCount() - MapItem.dwCanPickUpTick) > GameConfig.dwFloorItemCanPickUpTime) // 2 * 60 * 1000
            {
                MapItem.OfBaseObject = null;
            }
            if (this.PlugOfCheckCanItem(9, MapItem.Name, false, 0, 0))  // 禁止物品规则(管理插件功能)
            {
                this.SysMsg(GameMsgDef.g_sPickUpItemHintMsg, TMsgColor.c_Red, TMsgType.t_Hint);// 提示 禁止捡起
                return result;
            }
            if (!ClientPickUpItem_IsSelf(((MapItem.OfBaseObject) as TBaseObject)) && !ClientPickUpItem_IsOfGroup(((MapItem.OfBaseObject) as TBaseObject)))
            {
                // '在一定时间以内无法捡起此物品！！！'
                this.SysMsg(GameMsgDef.g_sCanotPickUpItem, TMsgColor.c_Red, TMsgType.t_Hint);
                return result;
            }
            if (string.Compare(MapItem.Name, M2Share.sSTRING_GOLDNAME, true) == 0) //如果是金币，直接增加到玩家身上
            {
                if (this.m_PEnvir.DeleteFromMap(this.m_nCurrX, this.m_nCurrY, Grobal2.OS_ITEMOBJECT, MapItem) == 1)
                {
                    if (IncGold(MapItem.Count))
                    {
                        this.SendRefMsg(Grobal2.RM_ITEMHIDE, 0, MapItem.ToInt(), this.m_nCurrX, this.m_nCurrY, "");
                        if (M2Share.g_boGameLogGold)
                        {
                            M2Share.AddGameDataLog("4" + "\09" + this.m_sMapName + "\09" + this.m_nCurrX + "\09" + this.m_nCurrY + "\09" + this.m_sCharName + "\09"
                                + M2Share.sSTRING_GOLDNAME + "\09" + MapItem.Count + "\09" + "1" + "\09" + "0");
                        }
                        this.GoldChanged();
                        Dispose(MapItem);
                    }
                    else
                    {
                        this.m_PEnvir.AddToMap(this.m_nCurrX, this.m_nCurrY, Grobal2.OS_ITEMOBJECT, MapItem);
                    }
                }
                return result;
            }
            if (IsEnoughBag())
            {
                if (this.m_PEnvir.DeleteFromMap(this.m_nCurrX, this.m_nCurrY, Grobal2.OS_ITEMOBJECT, MapItem) == 1) //是否从地图删除物品
                {
                    UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));//by John 修正
                    for (int i = 0; i < 22; i++)
                    {
                        UserItem->btValue[i] = 0;
                    }
                    UserItem = MapItem.UserItem;
                    StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                    if ((StdItem != null))
                    {
                        if (this.IsAddWeightAvailable(UserEngine.GetStdItemWeight(UserItem->wIndex)))
                        {
                            this.SendMsg(this, Grobal2.RM_ITEMHIDE, 0, MapItem.ToInt(), this.m_nCurrX, this.m_nCurrY, "");//从当前地图删除物品
                            ClearCopyItem(0, UserItem->wIndex, UserItem->MakeIndex);// 清理包裹和仓库复制物品
                            this.AddItemToBag(UserItem);
                            if (StdItem->NeedIdentify == 1)
                            {
                                M2Share.AddGameDataLog("4" + "\09" + this.m_sMapName + "\09" + this.m_nCurrX + "\09" +
                                    this.m_nCurrY + "\09" + this.m_sCharName + "\09" + HUtil32.SBytePtrToString(StdItem->Name, StdItem->NameLen) + "\09" + UserItem->MakeIndex +
                                    "\09" + "(" + (HUtil32.LoWord(StdItem->DC)).ToString() + "/" + (HUtil32.HiWord(StdItem->DC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MC)).ToString()
                                    + "/" + (HUtil32.HiWord(StdItem->MC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->SC)).ToString() + "/" + (HUtil32.HiWord(StdItem->SC)).ToString() + ")"
                                    + "(" + (HUtil32.LoWord(StdItem->AC)).ToString() + "/" + (HUtil32.HiWord(StdItem->AC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MAC)).ToString() + "/"
                                    + (HUtil32.HiWord(StdItem->MAC)).ToString() + ")" + (UserItem->btValue[0]).ToString() + "/" + (UserItem->btValue[1]).ToString() + "/" + (UserItem->btValue[2]).ToString()
                                    + "/" + (UserItem->btValue[3]).ToString() + "/" + (UserItem->btValue[4]).ToString() + "/" + (UserItem->btValue[5]).ToString() + "/"
                                    + (UserItem->btValue[6]).ToString() + "/" + (UserItem->btValue[7]).ToString() + "/" + (UserItem->btValue[8]).ToString() + "/" +
                                    (UserItem->btValue[14]).ToString() + "\09" + (UserItem->Dura).ToString() + "/" + (UserItem->DuraMax).ToString());
                            }
                            Dispose(MapItem);
                            if (this.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                            {
                                PlayObject = ((this) as TPlayObject);
                                PlayObject.SendAddItem(UserItem);
                            }
                            result = true;
                        }
                        else
                        {
                            Marshal.FreeHGlobal((IntPtr)UserItem);
                            this.m_PEnvir.AddToMap(this.m_nCurrX, this.m_nCurrY, Grobal2.OS_ITEMOBJECT, MapItem);
                        }
                    }
                }
            }
            return result;
        }

        /// <summary>
        /// 运行游戏公告
        /// </summary>
        public void RunNotice()
        {
            TProcessMessage Msg;
            const string sExceptionMsg = "{异常} TPlayObject::RunNotice";
            if (m_boEmergencyClose || m_boKickFlag || m_boSoftClose)
            {
                if (m_boKickFlag)
                {
                    SendDefMessage(Grobal2.SM_OUTOFCONNECTION, 0, 0, 0, 0, "");//超过最大连接数
                }
                MakeGhost();
            }
            else
            {
                try
                {
                    if (!m_boSendNotice)
                    {
                        SendNotice();//发送游戏公告
                        m_boSendNotice = true;
                        m_dwWaitLoginNoticeOKTick = HUtil32.GetTickCount();
                    }
                    else
                    {
                        if (HUtil32.GetTickCount() - m_dwWaitLoginNoticeOKTick > 30000) // 30 * 1000
                        {
                            m_boEmergencyClose = true;//设置玩家标识掉线处理
                        }
                        Msg = new TProcessMessage();
                        while (this.GetMessage(Msg))
                        {
                            if (Msg.wIdent == Grobal2.CM_LOGINNOTICEOK)
                            {
                                m_boLoginNoticeOK = true;
                                m_dwClientTick = (uint)Msg.nParam1;
                                this.SysMsg(Convert.ToString(m_dwClientTick), TMsgColor.c_Red, TMsgType.t_Notice);
                            }
                        }
                        Msg = null;
                        Dispose(Msg);
                    }
                }
                catch
                {
                    M2Share.MainOutMessage(sExceptionMsg);
                }
            }
        }

        /// <summary>
        /// 杀怪取得经验
        /// </summary>
        /// <param name="dwExp"></param>
        public void WinExp(UInt32 dwExp)
        {
            try
            {
                if (this.m_Abil.Level > GameConfig.nLimitExpLevel)// 超过限制等级,只给指定的限制经验
                {
                    dwExp = GameConfig.nLimitExpValue;
                    GetExp(dwExp, false, 0);
                }
                else if (dwExp > 0)
                {
                    if (m_nKillMonExpRate <= 0)
                    {
                        m_nKillMonExpRate = 100; // 防止倍数为负数
                    }
                    dwExp = GameConfig.dwKillMonExpMultiple * dwExp;// 系统指定杀怪经验倍数
                    dwExp = (UInt32)HUtil32.Round((double)(m_nKillMonExpRate / 100) * dwExp, 1);// 人物指定的杀怪经验倍数
                    if (this.m_PEnvir != null)
                    {
                        if (this.m_PEnvir.m_boEXPRATE)
                        {
                            dwExp = (UInt32)HUtil32.Round((double)(this.m_PEnvir.m_nEXPRATE / 100) * dwExp, 1);  // 地图上指定杀怪经验倍数
                        }
                    }
                    if (this.m_boExpItem) // 物品经验倍数
                    {
                        dwExp = (UInt32)HUtil32.Round((double)this.m_rExpItem * dwExp, 1);
                    }
                    GetExp(dwExp, false, 0);
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.WinExp");
            }
        }

        /// <summary>
        /// 取得内力经验
        /// </summary>
        /// <param name="dwExp"></param>
        /// <param name="Code">0-杀怪分配 1-非杀怪分配 2-饮酒(谁喝分配给谁) 3-提取天地结晶经验</param>
        public void GetNGExp(UInt32 dwExp, byte Code)
        {
            try
            {
                if (this.m_Abil.Level > GameConfig.nLimitExpLevel) // 超过限制等级,只给指定的限制经验
                {
                    dwExp = GameConfig.nLimitExpValue;
                }
                else if ((dwExp > 0) && (Code == 0))
                {
                    dwExp = GameConfig.dwKillMonExpMultiple * dwExp;// 系统指定杀怪经验倍数
                    dwExp = (uint)HUtil32.Round((double)(m_nKillMonExpRate / 100) * dwExp, 1);// 人物指定的杀怪经验倍数
                    if (this.m_PEnvir != null)
                    {
                        if (this.m_PEnvir.m_boEXPRATE)// 地图上指定杀怪经验倍数
                        {
                            dwExp = (uint)HUtil32.Round((double)(this.m_PEnvir.m_nEXPRATE / 100) * dwExp, 1);
                        }
                    }
                    if (this.m_boExpItem) // 物品经验倍数
                    {
                        dwExp = (uint)HUtil32.Round((double)this.m_rExpItem * dwExp, 1);
                    }
                }
                if (m_MyHero != null)
                {
                    if ((!m_MyHero.m_boDeath) && (!m_MyHero.m_boGhost))
                    {
                        switch (Code)
                        {
                            case 0:
                                ((THeroObject)(m_MyHero)).GetNGExp((uint)Math.Abs(HUtil32.Round((double)(GameConfig.nHeroKillMonExpRate / 100) * dwExp, 1)), 3);
                                dwExp = (uint)Math.Abs(HUtil32.Round((double)((100 - GameConfig.nHeroKillMonExpRate) / 100) * dwExp, 1));
                                dwExp = (uint)Math.Abs(HUtil32.Round((double)dwExp * GameConfig.dwKillMonNGExpMultiple / 100, 1));
                                break;
                            case 1:
                                // 杀怪内功经验倍数
                                // 非杀怪,英雄与主人一样经验
                                ((THeroObject)(m_MyHero)).GetNGExp(dwExp, 1);
                                break;
                            case 3:
                                // 提取天地结晶内功经验，英雄分配比例
                                ((THeroObject)(m_MyHero)).GetNGExp((uint)Math.Abs(HUtil32.Round((double)(GameConfig.nHeroCrystalExpRate / 100) * dwExp, 1)), 2);
                                dwExp = (uint)Math.Abs(HUtil32.Round((double)((100 - GameConfig.nHeroCrystalExpRate) / 100) * dwExp, 1));
                                break;
                        }
                    }
                }
                else
                {
                    if ((dwExp > 0) && (Code == 0))
                    {
                        dwExp = (uint)Math.Abs(HUtil32.Round((double)dwExp * GameConfig.dwKillMonNGExpMultiple / 100, 1));// 杀怪内功经验倍数
                    }
                }
                if (m_boTrainingNG && (dwExp > 0))
                {
                    if (m_ExpSkill69 >= (uint)dwExp)
                    {
                        if ((uint.MaxValue - m_ExpSkill69) < (uint)dwExp)
                        {
                            dwExp = int.MaxValue - m_ExpSkill69;
                        }
                    }
                    else
                    {
                        if ((int.MaxValue - dwExp) < m_ExpSkill69)
                        {
                            dwExp = int.MaxValue - dwExp;
                        }
                    }
                    m_ExpSkill69 += dwExp; // 内功心法当前经验
                    if (!m_boNotOnlineAddExp)
                    {
                        this.SendMsg(this, Grobal2.RM_WINNHEXP, 0, (int)dwExp, 0, 0, "");
                    }
                    // 只发送给非离线挂机人物
                    if (m_ExpSkill69 >= m_MaxExpSkill69)
                    {
                        m_ExpSkill69 -= m_MaxExpSkill69;
                        m_NGLevel++;
                        m_MaxExpSkill69 = this.GetSkill69Exp(m_NGLevel, ref m_Skill69MaxNH);// 取内功心法升级经验
                        m_Skill69NH = m_Skill69MaxNH;
                        this.SendRefMsg(Grobal2.RM_MAGIC69SKILLNH, 0, m_Skill69NH, m_Skill69MaxNH, 0, "");// 内力值让别人看到
                        this.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTLEVELUP, 0, 0, 0, "");// 人物升级动画 
                        NGLevelUpFunc();// 内功升级触发
                    }
                    this.SendNGData();
                    if (Code != 3)
                    {
                        GetExpToCrystal(dwExp, 1); // 取经验到天地结晶中
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.GetNGExp");
            }
        }

        /// <summary>
        /// 内功技能升级
        /// </summary>
        /// <param name="UserMagic"></param>
        public unsafe void NGMagic_Lvexp(TUserMagic* UserMagic)
        {
            if ((UserMagic != null))
            {
                if ((this.m_btRaceServer == Grobal2.RC_PLAYOBJECT) && (UserMagic->btLevel < 3) && (UserMagic->MagicInfo.TrainLevel[UserMagic->btLevel] <= m_NGLevel))
                {
                    this.TrainSkill(UserMagic, HUtil32.Random(3) + 1);
                    if (!this.CheckMagicLevelup(UserMagic))
                    {
                        this.SendDelayMsg(this, Grobal2.RM_MAGIC_LVEXP, 0, UserMagic->MagicInfo.wMagicId, UserMagic->btLevel, UserMagic->nTranPoint, "", 3000);
                    }
                }
            }
        }

        /// <summary>
        /// 取得经验
        /// </summary>
        /// <param name="dwExp"></param>
        /// <param name="boItmeExp">False-将经验累积到聚灵珠中 True-不累积经验到聚灵珠中</param>
        /// <param name="nType">3-提取天地结晶经验</param>
        public unsafe void GetExp(UInt32 dwExp, bool boItmeExp, byte nType)
        {
            byte nCode = 0;
            try
            {
                if (this.m_Abil.Exp >= dwExp)
                {
                    if ((int.MaxValue - this.m_Abil.Exp) < dwExp)
                    {
                        dwExp = int.MaxValue - this.m_Abil.Exp;
                    }
                }
                else
                {
                    if ((int.MaxValue - dwExp) < this.m_Abil.Exp)
                    {
                        dwExp = int.MaxValue - dwExp;
                    }
                }
                if (!boItmeExp)
                {
                    GetExpToItem(dwExp); // 取得的经验,累积到聚灵珠
                }
                nCode = 11;
                if (m_MyHero != null) // 人取得经验,都给英雄分配经验
                {
                    nCode = 12;
                    if ((!m_MyHero.m_boDeath) && (!m_MyHero.m_boGhost))
                    {
                        nCode = 10;
                        switch (nType)
                        {
                            case 3:// 提取天地结晶经验
                                ((THeroObject)(m_MyHero)).GetExp((uint)Math.Abs(HUtil32.Round((double)GameConfig.nHeroCrystalExpRate / 100 * dwExp)));
                                dwExp = (uint)Math.Abs(HUtil32.Round(100 - (double)GameConfig.nHeroCrystalExpRate / 100 * dwExp));
                                break;
                            default:
                                ((THeroObject)(m_MyHero)).GetExp((uint)Math.Abs(HUtil32.Round((double)GameConfig.nHeroKillMonExpRate / 100 * dwExp)));
                                dwExp = (uint)Math.Abs(HUtil32.Round(100 - (double)GameConfig.nHeroKillMonExpRate / 100 * dwExp));
                                break;
                        }
                    }
                }
                nCode = 3;
                m_GetExp = dwExp;// 人物取得的经验,$GetExp变量使用
                if (M2Share.g_FunctionNPC != null)
                {
                    M2Share.g_FunctionNPC.GotoLable(this, "@GetExp", false); // 经验触发
                }
                this.m_Abil.Exp += dwExp;
                this.AddBodyLuck(dwExp * 0.002);
                if (!m_boNotOnlineAddExp) // 只发送给非离线挂机人物
                {
                    this.SendMsg(this, Grobal2.RM_WINEXP, 0, dwExp, 0, 0, "");
                }
                nCode = 4;
                if (this.m_Abil.Exp >= this.m_Abil.MaxExp)
                {
                    this.m_Abil.Exp -= this.m_Abil.MaxExp;
                    if ((this.m_Abil.Level < M2Share.MAXUPLEVEL) && (this.m_Abil.Level < GameConfig.nLimitExpLevel))
                    {
                        this.m_Abil.Level++;
                    }
                    // 增加限制等级
                    if (this.m_Abil.Level < GameConfig.nLimitExpLevel)
                    {
                        this.HasLevelUp(this.m_Abil.Level - 1);//  增加限制等级
                    }
                    nCode = 5;
                    this.AddBodyLuck(100);// 人物升级记录日志
                    M2Share.AddGameDataLog("12" + "\09" + this.m_sMapName + "\09" + (this.m_Abil.Level).ToString() + "\09" + (this.m_Abil.Exp).ToString()
                        + "/" + (this.m_Abil.MaxExp).ToString() + "\09" + this.m_sCharName + "\09" + "0" + "\09" + "0" + "\09" + "1" + "\09" + "0");
                    nCode = 6;
                    this.IncHealthSpell(2000, 2000);
                }
                nCode = 7;
                if (this.m_Magic68Skill != null)// 学过酒气护体
                {
                    if (this.m_Magic68Skill->btLevel < 100)
                    {
                        m_Exp68 += (UInt16)dwExp;
                    }
                    if (m_Exp68 >= m_MaxExp68) // 超过升级经验,则升级技能
                    {
                        m_Exp68 -= m_MaxExp68;
                        if (this.m_Magic68Skill->btLevel < 100)
                        {
                            this.m_Magic68Skill->btLevel++;
                        }
                        nCode = 8;
                        m_MaxExp68 = (UInt16)this.GetSkill68Exp(this.m_Magic68Skill->btLevel);
                        this.SendDelayMsg(this, Grobal2.RM_MAGIC_LVEXP, 0, this.m_Magic68Skill->MagicInfo.wMagicId, this.m_Magic68Skill->btLevel, this.m_Magic68Skill->nTranPoint, "", 100);
                    }
                    nCode = 9;
                    if ((this != null) && (this.m_Magic68Skill->btLevel < 100))// 发送酒气护体经验
                    {
                        this.SendMsg(this, Grobal2.RM_MAGIC68SKILLEXP, 0, 0, 0, 0, EncryptUnit.EncodeString(m_Exp68 + "/" + m_MaxExp68)); // 发消息更新客户端显示
                    }
                }
                if ((nType != 3))
                {
                    GetExpToCrystal(dwExp, 0);//取经验到天地结晶中
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.GetExp Code:" + nCode);
            }
        }

        /// <summary>
        /// 客户端提取天地结晶经验
        /// </summary>
        /// <param name="dwExp"></param>
        /// <param name="nType"> 0-经验 1-内功经验</param>
        public void GetExpToCrystal(UInt32 dwExp, byte nType)
        {
            if (m_boShowExpCrystal)
            {
                switch (nType)
                {
                    case 0:// 天地结晶图标为显示时 经验
                        if ((m_CrystalMaxExp == 0) && (m_CrystalLevel < 5))  // 天地结晶等级为0时，取当前经验的上限值
                        {
                            GetExpCrystal(m_CrystalLevel, ref m_CrystalMaxExp, ref m_CrystalNGMaxExp);// 取天地结晶当前等级经验上限
                        }
                        if (m_CrystalLevel < 5)
                        {
                            m_CrystalExp += dwExp; // 天地结晶当前经验
                        }
                        if ((m_CrystalExp >= m_CrystalMaxExp) && (m_CrystalNGExp >= m_CrystalNGMaxExp) && (m_CrystalLevel < 5))
                        {
                            // 超过升级经验,并且内功经验超过升级经验,则天地结晶升级
                            if (m_CrystalLevel < 5)
                            {
                                m_boGetExpCrystalExp = true;// 是否可以提取经验
                                m_nGetCrystalExp = m_CrystalMaxExp;// 可提取天地结晶经验
                                m_nGetCrystalNGExp = m_CrystalNGMaxExp;// 天可提取地结晶内功经验
                                m_CrystalLevel++;
                            }
                            if (m_CrystalLevel < 5)
                            {
                                GetExpCrystal(m_CrystalLevel, ref m_CrystalMaxExp, ref m_CrystalNGMaxExp); // 取天地结晶当前等级经验上限
                            }
                            SendDefMessage(Grobal2.SM_SENDCRYSTALLEVEL, m_CrystalLevel, 0, 0, 0, "");// 发送天地结晶的等级
                        }
                        if ((this != null) && (m_CrystalLevel < 5))
                        {
                            SendDefMessage(Grobal2.SM_SENDCRYSTALEXP, 0, 0, 0, 0, m_CrystalExp + "/" + m_CrystalMaxExp + "/" + m_CrystalNGMaxExp);
                        }
                        break;
                    case 1:// 发送天地结晶经验 内功经验
                        if ((m_CrystalNGMaxExp == 0) && (m_CrystalLevel < 5))// 取当前经验的上限值
                        {
                            GetExpCrystal(m_CrystalLevel, ref m_CrystalMaxExp, ref m_CrystalNGMaxExp);// 取天地结晶当前等级经验上限
                        }
                        if (m_CrystalLevel < 5)
                        {
                            m_CrystalNGExp += dwExp;// 天地结晶当前经验
                        }
                        if ((m_CrystalExp >= m_CrystalMaxExp) && (m_CrystalNGExp >= m_CrystalNGMaxExp) && (m_CrystalLevel < 5))// 超过升级经验,并且内功经验超过升级经验,则天地结晶升级
                        {
                            if (m_CrystalLevel < 5)
                            {
                                m_boGetExpCrystalExp = true;// 是否可以提取经验 
                                m_nGetCrystalExp = m_CrystalMaxExp;// 可提取天地结晶经验 
                                m_nGetCrystalNGExp = m_CrystalNGMaxExp;// 天可提取地结晶内功经验 
                                m_CrystalLevel++;
                            }
                            if (m_CrystalLevel < 5)
                            {
                                GetExpCrystal(m_CrystalLevel, ref m_CrystalMaxExp, ref m_CrystalNGMaxExp); // 取天地结晶当前等级经验上限
                            }
                            SendDefMessage(Grobal2.SM_SENDCRYSTALLEVEL, m_CrystalLevel, 0, 0, 0, "");// 发送天地结晶的等级
                        }
                        if ((this != null) && (m_CrystalLevel < 5))
                        {
                            SendDefMessage(Grobal2.SM_SENDCRYSTALNGEXP, 0, 0, 0, 0, m_CrystalNGExp + "/" + m_CrystalMaxExp + "/" + m_CrystalNGMaxExp);
                        }
                        break;
                }
            }
        }


        /// <summary>
        /// 取得的经验,累积到物品上,-----聚灵珠
        /// </summary>
        /// <param name="dwExp"></param>
        public unsafe void GetExpToItem(uint dwExp)
        {
            TUserItem* UserItem = null;
            TStdItem* AmuletStdItem;
            bool boGetExpToItem;
            bool boHeroToItem;
            byte nCode;
            nCode = 0;
            boGetExpToItem = false;
            boHeroToItem = false;
            try
            {
                if (this.m_boDeath || this.m_boGhost)// 死亡不再聚
                {
                    return;
                }
                nCode = 1;
                if (this.m_ItemList.Count > 0)
                {
                    nCode = 11;
                    for (int I = 0; I < this.m_ItemList.Count; I++) // 人物包裹不为空
                    {
                        nCode = 12;
                        UserItem = (TUserItem*)this.m_ItemList[I];
                        if (UserItem != null)
                        {
                            nCode = 13;
                            AmuletStdItem = UserEngine.GetStdItem(UserItem->wIndex);
                            if (AmuletStdItem != null)
                            {
                                if ((AmuletStdItem->StdMode == 51) && (AmuletStdItem->Shape == 0) && (UserItem->btValue[12] != 2) && (UserItem->Dura < UserItem->DuraMax))
                                {
                                    // 聚灵珠
                                    nCode = 3;
                                    if (this.m_PEnvir != null)
                                    {
                                        if (!this.m_PEnvir.AllowStdItems(HUtil32.SBytePtrToString(AmuletStdItem->Name, 0, AmuletStdItem->NameLen))) // 检查地图是否禁用聚灵珠
                                        {
                                            return;
                                        }
                                    }
                                    nCode = 34;
                                    if (UserItem->btValue[20] == 1)
                                    {
                                        boGetExpToItem = true;
                                    }
                                    if (n_UsesItemTick == 0) // 24 * 60 * 60
                                    {
                                        n_UsesItemTick = AmuletStdItem->AniCount * 86400;// 使用时间
                                        boGetExpToItem = true;
                                        UserItem->btValue[20] = 1;
                                    }
                                    if (boGetExpToItem)
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
                nCode = 2;
                if (!boGetExpToItem && (m_MyHero != null))
                {
                    nCode = 21;
                    if (m_MyHero.m_boDeath || m_MyHero.m_boGhost) // 死亡不再聚
                    {
                        return;
                    }
                    nCode = 22;
                    if (m_MyHero.m_ItemList != null)
                    {
                        nCode = 23;
                        if (m_MyHero.m_ItemList.Count > 0)
                        {
                            nCode = 24;
                            for (int I = 0; I < m_MyHero.m_ItemList.Count; I++)// 人物包里没有珠,英雄包裹不为空时
                            {
                                nCode = 25;
                                UserItem = (TUserItem*)m_MyHero.m_ItemList[I];
                                if (UserItem != null)
                                {
                                    nCode = 26;
                                    AmuletStdItem = UserEngine.GetStdItem(UserItem->wIndex);
                                    if (AmuletStdItem != null)
                                    {
                                        if ((AmuletStdItem->StdMode == 51) && (AmuletStdItem->Shape == 0) &&
                                            (UserItem->btValue[12] != 2) && (UserItem->Dura < UserItem->DuraMax)) // 聚灵珠
                                        {
                                            nCode = 32;
                                            if (m_MyHero.m_PEnvir != null)
                                            {
                                                if (!m_MyHero.m_PEnvir.AllowStdItems(HUtil32.SBytePtrToString(AmuletStdItem->Name, 0, AmuletStdItem->NameLen)))// 检查地图是否禁用聚灵珠
                                                {
                                                    return;
                                                }
                                            }
                                            nCode = 33;
                                            if (UserItem->btValue[20] == 1)
                                            {
                                                boHeroToItem = true;
                                            }
                                            if (n_UsesItemTick == 0)
                                            {
                                                n_UsesItemTick = AmuletStdItem->AniCount * 86400;// 使用时间 24 * 60 * 60
                                                boHeroToItem = true;
                                                UserItem->btValue[20] = 1;
                                            }
                                            if (boHeroToItem)
                                            {
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                nCode = 4;
                if (this.m_nWinExp >= dwExp)
                {
                    if ((uint.MaxValue - this.m_nWinExp) < dwExp)
                    {
                        dwExp = uint.MaxValue - this.m_nWinExp;
                    }
                }
                else
                {
                    if ((uint.MaxValue - dwExp) < this.m_nWinExp)
                    {
                        dwExp = int.MaxValue - dwExp;
                    }
                }
                if (boGetExpToItem)// 主人包裹里聚经验
                {
                    this.m_nWinExp += dwExp;
                    if (this.m_nWinExp >= 10000)
                    {
                        if ((UserItem->Dura + this.m_nWinExp / 10000) > UserItem->DuraMax)
                        {
                            while (true)
                            {
                                if (this.m_nWinExp < 10000)
                                {
                                    break;
                                }
                                UserItem->Dura++;
                                this.m_nWinExp -= 10000;
                                if (UserItem->Dura >= UserItem->DuraMax)
                                {
                                    UserItem->Dura = UserItem->DuraMax;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            UserItem->Dura += Convert.ToUInt16(this.m_nWinExp / 10000);
                            this.m_nWinExp = this.m_nWinExp % 10000;
                            if (UserItem->Dura >= UserItem->DuraMax)
                            {
                                UserItem->Dura = UserItem->DuraMax;
                            }
                        }
                        this.SendMsg(this, Grobal2.RM_DURACHANGE, UserItem->wIndex, UserItem->Dura, UserItem->DuraMax, 0, "");
                        SendUpdateItem(UserItem);// 更新物品
                        SendItemUseTime(n_UsesItemTick);//发送物品使用时间
                    }
                    if (UserItem->Dura >= UserItem->DuraMax)
                    {
                        UserItem->Dura = UserItem->DuraMax;
                        n_UsesItemTick = 0;
                        UserItem->btValue[12] = 2;//不能聚集的标识
                        SendItemUseTime(n_UsesItemTick);// 发送聚灵珠使用剩余时间
                        this.SysMsg("【聚灵珠】已聚集足够的经验，请双击使用!", TMsgColor.c_Green, TMsgType.t_Hint);
                    }
                }
                else if (boHeroToItem)// 英雄包裹里,珠子聚经验
                {
                    nCode = 5;
                    this.m_nWinExp += dwExp;
                    if (this.m_nWinExp >= 10000)
                    {
                        if ((UserItem->Dura + this.m_nWinExp / 10000) > UserItem->DuraMax)
                        {
                            while (true)
                            {
                                if (this.m_nWinExp < 10000)
                                {
                                    break;
                                }
                                UserItem->Dura++;
                                this.m_nWinExp -= 10000;
                                if (UserItem->Dura >= UserItem->DuraMax)
                                {
                                    UserItem->Dura = UserItem->DuraMax;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            UserItem->Dura += Convert.ToUInt16(this.m_nWinExp / 10000);
                            this.m_nWinExp = this.m_nWinExp % 10000;
                            if (UserItem->Dura >= UserItem->DuraMax)
                            {
                                UserItem->Dura = UserItem->DuraMax;
                            }
                        }
                        ((THeroObject)(m_MyHero)).SendMsg(m_MyHero, Grobal2.RM_HERODURACHANGE, UserItem->wIndex, UserItem->Dura, UserItem->DuraMax, 0, "");
                        ((THeroObject)(m_MyHero)).SendUpdateItem(UserItem);// 更新物品
                        SendItemUseTime(n_UsesItemTick);//发送物品剩余时间
                        ((THeroObject)(m_MyHero)).SendUpdateItem(UserItem);// 更新物品
                    }
                    if (UserItem->Dura >= UserItem->DuraMax)
                    {
                        UserItem->Dura = UserItem->DuraMax;
                        n_UsesItemTick = 0;
                        UserItem->btValue[12] = 2;//不能聚集的标识
                        SendItemUseTime(n_UsesItemTick);// 发送聚灵珠使用剩余时间
                        this.SysMsg("【聚灵珠】已聚集足够的经验，请双击使用!", TMsgColor.c_Green, TMsgType.t_Hint);
                    }
                }
                nCode = 6;
                if (!boGetExpToItem && !boHeroToItem)
                {
                    n_UsesItemTick = 0;//主人英雄都没有珠子,则初始
                }
                if (this.m_nWinExp < 0)
                {
                    this.m_nWinExp = 0;
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.GetExpToItem Code:" + (nCode).ToString());
            }
        }

        /// <summary>
        /// 发送聚灵珠使用剩余时间
        /// </summary>
        /// <param name="dwTime"></param>
        public unsafe void SendItemUseTime(int dwTime)
        {
            TUserItem* UserItem;
            TStdItem* AmuletStdItem;
            bool boGetExpToItem;
            boGetExpToItem = false;
            if (this.m_ItemList.Count > 0)
            {
                for (int I = 0; I < this.m_ItemList.Count; I++) // 人物包裹不为空
                {
                    UserItem = (TUserItem*)this.m_ItemList[I];
                    AmuletStdItem = UserEngine.GetStdItem(UserItem->wIndex);
                    if (AmuletStdItem != null)
                    {
                        if ((AmuletStdItem->StdMode == 51) && (AmuletStdItem->Shape == 0) && (UserItem->btValue[20] == 1)) // 聚灵珠
                        {
                            dwTime = dwTime / 3600;
                            this.SendMsg(this, Grobal2.RM_EXPTIMEITEMS, 0, UserItem->MakeIndex, dwTime, 0, "");// 发送聚灵珠剩于时间
                            boGetExpToItem = true;
                            break;
                        }
                    }
                }
            }
            if (!boGetExpToItem && (m_MyHero != null))
            {
                if (m_MyHero.m_ItemList.Count > 0)
                {
                    for (int I = 0; I < m_MyHero.m_ItemList.Count; I++)// 英雄包裹不为空
                    {
                        UserItem = (TUserItem*)m_MyHero.m_ItemList[I];
                        AmuletStdItem = UserEngine.GetStdItem(UserItem->wIndex);
                        if (AmuletStdItem != null)
                        {
                            if ((AmuletStdItem->StdMode == 51) && (AmuletStdItem->Shape == 0) && (UserItem->btValue[20] == 1))// 聚灵珠
                            {
                                dwTime = dwTime / 3600;
                                this.SendMsg(this, Grobal2.RM_EXPTIMEITEMS, 0, UserItem->MakeIndex, dwTime, 0, "");// 发送聚灵珠剩于时间
                                break;
                            }
                        }
                    }
                }
            }
        }

        /// <summary>
        /// 发送聚灵珠使用剩余时间 
        /// </summary>
        /// <param name="nCode">参数为1时,发送经验值,用于人物上线时发送</param>
        /// <returns></returns>
        public unsafe bool IsItem_51(int nCode)
        {
            bool result = false;
            int I;
            TUserItem* UserItem;
            TStdItem* AmuletStdItem;
            bool boGetExpToItem;
            try
            {
                result = false;
                boGetExpToItem = false;
                if (this.m_ItemList.Count > 0)
                {
                    for (I = 0; I < this.m_ItemList.Count; I++)// 人物包裹不为空
                    {
                        UserItem = (TUserItem*)this.m_ItemList[I];
                        if (UserItem != null)
                        {
                            AmuletStdItem = UserEngine.GetStdItem(UserItem->wIndex);
                            if (AmuletStdItem != null)
                            {
                                if ((AmuletStdItem->StdMode == 51) && (AmuletStdItem->Shape == 0) && (UserItem->btValue[12] != 2))
                                {
                                    switch (nCode)
                                    {
                                        case 1:// 聚灵珠
                                            if (UserItem->btValue[20] != 1)
                                            {
                                                continue;
                                            }
                                            if (this.m_nWinExp >= 10000)
                                            {
                                                UserItem->Dura++;
                                                this.m_nWinExp -= 10000;
                                                boGetExpToItem = true;
                                                if (UserItem->Dura > UserItem->DuraMax)
                                                {
                                                    UserItem->Dura = UserItem->DuraMax;
                                                }
                                            }
                                            this.SendMsg(this, Grobal2.RM_DURACHANGE, UserItem->wIndex, UserItem->Dura, UserItem->DuraMax, 0, "");
                                            SendItemUseTime(n_UsesItemTick);
                                            break;
                                        case 2:
                                            n_UsesItemTick = 0;// 时间初始
                                            UserItem->btValue[12] = 2; //增加,不能聚集的标识
                                            break;
                                    }
                                    result = true;
                                    break;
                                }
                            }
                        }
                    }
                }
                if ((nCode == 1) && !boGetExpToItem && (m_MyHero != null))
                {
                    if (m_MyHero.m_ItemList.Count > 0)
                    {
                        for (I = 0; I < m_MyHero.m_ItemList.Count; I++)// 英雄包裹不为空
                        {
                            UserItem = (TUserItem*)m_MyHero.m_ItemList[I];
                            if (UserItem != null)
                            {
                                AmuletStdItem = UserEngine.GetStdItem(UserItem->wIndex);
                                if (AmuletStdItem != null)
                                {
                                    if ((AmuletStdItem->StdMode == 51) && (AmuletStdItem->Shape == 0) && (UserItem->btValue[12] != 2)) // 聚灵珠
                                    {
                                        if (UserItem->btValue[20] != 1)
                                        {
                                            continue;
                                        }
                                        if (this.m_nWinExp >= 10000)
                                        {
                                            UserItem->Dura++;
                                            this.m_nWinExp -= 10000;
                                            if (UserItem->Dura > UserItem->DuraMax)
                                            {
                                                UserItem->Dura = UserItem->DuraMax;
                                            }
                                        }
                                        ((THeroObject)(m_MyHero)).SendMsg(m_MyHero, Grobal2.RM_HERODURACHANGE, UserItem->wIndex, UserItem->Dura, UserItem->DuraMax, 0, "");
                                        SendItemUseTime(n_UsesItemTick);
                                        ((THeroObject)(m_MyHero)).SendUpdateItem(UserItem);// 更新物品
                                        result = true;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.IsItem_51");
            }
            return result;
        }

        /// <summary>
        /// 增加金币
        /// </summary>
        /// <param name="tGold"></param>
        /// <returns></returns>
        public bool IncGold(int tGold)
        {
            bool result = false;
            if (this.m_nGold + tGold <= GameConfig.nHumanMaxGold)
            {
                this.m_nGold += tGold;
                result = true;
            }
            return result;
        }

        /// <summary>
        /// 增加游戏金币
        /// </summary>
        /// <param name="nGameGold"></param>
        public void IncGameGold(int nGameGold)
        {
            m_nGameGold += nGameGold;
        }

        /// <summary>
        /// 增加金刚石
        /// </summary>
        /// <param name="nGameDiaMond"></param>
        public void IncGameDiaMond(int nGameDiaMond)
        {
            m_nGAMEDIAMOND += nGameDiaMond;
        }

        /// <summary>
        /// 增加灵符
        /// </summary>
        /// <param name="nGameGird"></param>
        public void IncGameGird(int nGameGird)
        {
            m_nGAMEGIRD += nGameGird;
        }

        /// <summary>
        /// 增加声望
        /// </summary>
        /// <param name="nGamePoint"></param>
        public void IncGamePoint(int nGamePoint)
        {
            m_nGamePoint += (UInt16)nGamePoint;
        }

        /// <summary>
        /// 玩家包裹是否满了
        /// </summary>
        /// <returns></returns>
        public bool IsEnoughBag()
        {
            return this.m_ItemList.Count < Grobal2.MAXBAGITEM;
        }

        /// <summary>
        /// 发送装备到玩家包裹
        /// </summary>
        /// <param name="UserItem"></param>
        public unsafe virtual void SendAddItem(TUserItem* UserItem)
        {
            TStdItem* pStdItem;
            TStdItem* StdItem;
            TClientItem* ClientItem = null;
            TOClientItem* OClientItem = null;
            string sUserItemName;
            if (m_nSoftVersionDateEx == 0)
            {
                pStdItem = UserEngine.GetStdItem(UserItem->wIndex);
                if (pStdItem == null)
                {
                    return;
                }
                StdItem = pStdItem;
                ItemUnit.GetItemAddValue(UserItem, StdItem);
                M2Share.CopyStdItemToOStdItem(StdItem, &OClientItem->s);
                sUserItemName = "";   // 取自定义物品名称
                if (UserItem->btValue[13] == 1)
                {
                    sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                }
                if (sUserItemName != "")
                {
                    HUtil32.StrToSByteArry(sUserItemName, OClientItem->s.Name, 14, ref OClientItem->s.NameLen);
                }
                OClientItem->MakeIndex = UserItem->MakeIndex;
                OClientItem->Dura = UserItem->Dura;
                OClientItem->DuraMax = UserItem->DuraMax;
                if (new ArrayList(new int[] { 15, 19, 20, 21, 22, 23, 24, 26 }).Contains(StdItem->StdMode))
                {
                    if (UserItem->btValue[8] == 0)
                    {
                        OClientItem->s.Shape = 0;
                    }
                    else
                    {
                        OClientItem->s.Shape = 130;
                    }
                }
                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_ADDITEM, HUtil32.ObjectToInt(this), 0, 0, 1, 0);
                SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(OClientItem, sizeof(TOClientItem)));
            }
            else
            {
                pStdItem = UserEngine.GetStdItem(UserItem->wIndex);
                if (pStdItem == null)
                {
                    return;
                }
                StdItem = pStdItem;
                ItemUnit.GetItemAddValue(UserItem, StdItem);
                ClientItem = (TClientItem*)Marshal.AllocHGlobal(sizeof(TClientItem));
                ClientItem->s = *StdItem;
                //Move(StdItem, ClientItem->s, sizeof(TStdItem));
                // 取自定义物品名称
                sUserItemName = "";
                if (UserItem->btValue[13] == 1)
                {
                    sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                }
                if (UserItem->btValue[12] == 1)// 物品发光
                {
                    ClientItem->s.Reserved1 = 1;
                }
                else
                {
                    ClientItem->s.Reserved1 = 0;
                }
                if (sUserItemName != "")
                {
                    HUtil32.StrToSByteArry(sUserItemName, ClientItem->s.Name, 14, ref ClientItem->s.NameLen);
                    //ClientItem->s->Name = sUserItemName;
                }
                ClientItem->MakeIndex = UserItem->MakeIndex;
                ClientItem->Dura = UserItem->Dura;
                ClientItem->DuraMax = UserItem->DuraMax;
                switch (StdItem->StdMode)
                {
                    case 8:
                        if (UserItem->btValue[0] != 0) // 材料的品质
                        {
                            ClientItem->s.AC = UserItem->btValue[0];
                        }
                        break;
                    case 15:
                    case 19:
                    case 20:
                    case 21:
                    case 22:
                    case 23:
                    case 24:
                    case 26:
                        if (UserItem->btValue[8] != 0)
                        {
                            ClientItem->s.Shape = 130;
                        }
                        break;
                    case 51:// 如果是聚灵珠,则换成小时数
                        if ((StdItem->Shape == 0))
                        {
                            ClientItem->s.Need = StdItem->AniCount * 24;
                        }
                        break;
                    case 60:// 酒类,除烧酒外
                        if ((StdItem->Shape != 0))
                        {
                            if (UserItem->btValue[0] != 0)
                            {
                                ClientItem->s.AC = UserItem->btValue[0]; // 酒的品质
                            }
                            if (UserItem->btValue[1] != 0)
                            {
                                ClientItem->s.MAC = UserItem->btValue[1]; // 酒的酒精度
                            }
                        }
                        break;
                }
                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_ADDITEM, HUtil32.ObjectToInt(this), 0, 0, 1, 0);
                SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(ClientItem, sizeof(TClientItem)));
            }
        }

        /// <summary>
        /// 是否组队成员
        /// </summary>
        /// <param name="Target"></param>
        /// <returns></returns>
        public bool IsGroupMember(TBaseObject Target)
        {
            bool result = false;
            byte nCode = 0;
            try
            {
                if ((m_GroupOwner == null) || (Target == null) || (this == null))
                {
                    return result;
                }
                nCode = 1;
                for (int I = 0; I < m_GroupOwner.m_GroupMembers.Count; I++)
                {
                    nCode = 2;
                    if (m_GroupOwner.m_GroupMembers[I] == Target)
                    {
                        nCode = 3;
                        result = true;
                        break;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.IsGroupMember Code:" + nCode);
            }
            return result;
        }

        /// <summary>
        /// 私聊
        /// </summary>
        /// <param name="whostr">对谁说的</param>
        /// <param name="saystr"></param>
        public void Whisper(string whostr, string saystr)
        {
            TPlayObject PlayObject = UserEngine.GetPlayObject(whostr);
            int svidx = 0;
            if (PlayObject != null)
            {
                if (!PlayObject.m_boReadyRun)
                {
                    // '无法发送信息.'
                    this.SysMsg(whostr + GameMsgDef.g_sCanotSendmsg, TMsgColor.c_Red, TMsgType.t_Hint);
                    return;
                }
                if (!PlayObject.m_boHearWhisper || PlayObject.IsBlockWhisper(this.m_sCharName))
                {
                    // ' 拒绝私聊！！！'
                    this.SysMsg(whostr + GameMsgDef.g_sUserDenyWhisperMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                    return;
                }
                if (GameConfig.boRecordClientMsg && (saystr != ""))
                {
                    M2Share.MainOutMessage("[私聊] " + this.m_sCharName + "=>" + PlayObject.m_sCharName + ":" + saystr);// 记录私聊聊天信息
                }
                if ((PlayObject.m_boNotOnlineAddExp) && (PlayObject.m_sAutoSendMsg != ""))// 离线挂机人物自动回复
                {
                    if (this.m_btPermission >= 10)
                    {
                        this.SendMsg(this, Grobal2.RM_WHISPER, 0, GameConfig.btGMWhisperMsgFColor, GameConfig.btGMWhisperMsgBColor, 0, PlayObject.m_sCharName + "=>" + " " + PlayObject.m_sAutoSendMsg);
                    }
                    else
                    {
                        this.SendMsg(this, Grobal2.RM_WHISPER, 0, m_btWhisperMsgFColor, GameConfig.btWhisperMsgBColor, 0, PlayObject.m_sCharName + "=>" + " " + PlayObject.m_sAutoSendMsg);
                    }
                    return;
                }
                if (this.m_btPermission > 0)
                {
                    PlayObject.SendMsg(PlayObject, Grobal2.RM_WHISPER, 0, GameConfig.btGMWhisperMsgFColor, GameConfig.btGMWhisperMsgBColor, 0, this.m_sCharName + "=> " + saystr);
                    // 取得私聊信息
                    // m_GetWhisperHuman 侦听私聊对象
                    if ((m_GetWhisperHuman != null) && (!m_GetWhisperHuman.m_boGhost))
                    {
                        m_GetWhisperHuman.SendMsg(m_GetWhisperHuman, Grobal2.RM_WHISPER, 0, GameConfig.btGMWhisperMsgFColor, GameConfig.btGMWhisperMsgBColor, 0, this.m_sCharName + "=>" + PlayObject.m_sCharName + " " + saystr);
                    }
                    if ((PlayObject.m_GetWhisperHuman != null) && (!PlayObject.m_GetWhisperHuman.m_boGhost))
                    {
                        PlayObject.m_GetWhisperHuman.SendMsg(PlayObject.m_GetWhisperHuman, Grobal2.RM_WHISPER, 0, GameConfig.btGMWhisperMsgFColor, GameConfig.btGMWhisperMsgBColor, 0, this.m_sCharName + "=>" + PlayObject.m_sCharName + " " + saystr);
                    }
                }
                else
                {
                    PlayObject.SendMsg(PlayObject, Grobal2.RM_WHISPER, 0, m_btWhisperMsgFColor, GameConfig.btWhisperMsgBColor, 0, this.m_sCharName + "=> " + saystr);
                    if ((m_GetWhisperHuman != null) && (!m_GetWhisperHuman.m_boGhost))
                    {
                        m_GetWhisperHuman.SendMsg(m_GetWhisperHuman, Grobal2.RM_WHISPER, 0, m_btWhisperMsgFColor, GameConfig.btWhisperMsgBColor, 0, this.m_sCharName + "=>" + PlayObject.m_sCharName + " " + saystr);
                    }
                    if ((PlayObject.m_GetWhisperHuman != null) && (!PlayObject.m_GetWhisperHuman.m_boGhost))
                    {
                        PlayObject.m_GetWhisperHuman.SendMsg(PlayObject.m_GetWhisperHuman, Grobal2.RM_WHISPER, 0, m_btWhisperMsgFColor, GameConfig.btWhisperMsgBColor, 0, this.m_sCharName + "=>" + PlayObject.m_sCharName + " " + saystr);
                    }
                }
            }
            else
            {
                if (UserEngine.FindOtherServerUser(whostr, ref svidx)) //查找其他服务器角色
                {
                    UserEngine.SendServerGroupMsg(Grobal2.SS_WHISPER, svidx, whostr + "/" + this.m_sCharName + "=> " + saystr);
                }
                else
                {
                    // '  没有在线！！！'
                    this.SysMsg(whostr + GameMsgDef.g_sUserNotOnLine, TMsgColor.c_Red, TMsgType.t_Hint);
                }
            }
        }

        /// <summary>
        /// 私聊
        /// </summary>
        /// <param name="sName"></param>
        /// <returns></returns>
        public bool IsBlockWhisper(string sName)
        {
            bool result = false;
            for (int I = 0; I < m_BlockWhisperList.Count; I++)
            {
                if ((sName).ToLower().CompareTo((m_BlockWhisperList[I]).ToLower()) == 0)
                {
                    result = true;
                    break;
                }
            }
            return result;
        }

        /// <summary>
        /// 发送消息
        /// </summary>
        /// <param name="DefMsg"></param>
        /// <param name="sMsg"></param>
        public unsafe virtual void SendSocket(TDefaultMessage m_DefMsg, string sMsg)
        {
            TMsgHeader MsgHdr;
            int nSendBytes;
            byte[] Buff = null;
            TDefaultMessage* DefMsg = &m_DefMsg;
            const string sExceptionMsg = "{异常} TPlayObject::SendSocket..";
            try
            {
                MsgHdr = new TMsgHeader();
                MsgHdr.dwCode = Grobal2.RUNGATECODE;
                MsgHdr.nSocket = m_nSocket;
                MsgHdr.wGSocketIdx = (short)m_nGSocketIdx;
                MsgHdr.wIdent = Common.GM_DATA;
                if (DefMsg != null)
                {
                    if (sMsg != "")
                    {
                        byte[] bMsg = HUtil32.StringToByteAry(sMsg);
                        MsgHdr.nLength = bMsg.Length + sizeof(TDefaultMessage) + 1;
                        nSendBytes = MsgHdr.nLength + sizeof(TMsgHeader);
                        Buff = new byte[nSendBytes + sizeof(int)];
                        fixed (byte* pb = Buff)
                        {
                            *(int*)pb = nSendBytes;
                            *(TMsgHeader*)(pb + sizeof(int)) = MsgHdr;
                            *(TDefaultMessage*)(pb + sizeof(int) + sizeof(TMsgHeader)) = *DefMsg;
                            Array.Copy(bMsg, 0, Buff, sizeof(TDefaultMessage) + sizeof(TMsgHeader) + sizeof(int), bMsg.Length);
                            Buff[Buff.Length - 1] = 0;
                        }
                    }
                    else
                    {
                        MsgHdr.nLength = sizeof(TDefaultMessage);
                        nSendBytes = MsgHdr.nLength + sizeof(TMsgHeader);
                        Buff = new byte[nSendBytes + sizeof(int)];
                        fixed (byte* pb = Buff)
                        {
                            *(int*)pb = nSendBytes;
                            *(TMsgHeader*)(pb + sizeof(int)) = MsgHdr;
                            *(TDefaultMessage*)(pb + sizeof(int) + sizeof(TMsgHeader)) = *DefMsg;
                        }
                    }
                }
                else
                {
                    if (sMsg != "")
                    {
                        byte[] bMsg = HUtil32.StringToByteAry(sMsg);
                        MsgHdr.nLength = -(bMsg.Length + 1);
                        nSendBytes = Math.Abs(MsgHdr.nLength) + sizeof(TMsgHeader);
                        Buff = new byte[nSendBytes + sizeof(int)];
                        fixed (byte* pb = Buff)
                        {
                            *(int*)pb = nSendBytes;
                            *(TMsgHeader*)(pb + sizeof(int)) = MsgHdr;
                            Array.Copy(bMsg, 0, Buff, sizeof(TMsgHeader) + sizeof(int), bMsg.Length);
                            Buff[Buff.Length - 1] = 0;
                        }
                    }
                }
                if (!M2Share.RunSocket.AddGateBuffer(m_nGateIdx, Buff))
                {
                    Dispose(Buff);
                    Buff = null;
                }
            }
            catch
            {
                M2Share.MainOutMessage(sExceptionMsg);
            }
        }

        /// <summary>
        /// 发送消息
        /// </summary>
        /// <param name="DefMsg"></param>
        /// <param name="sMsg"></param>
        public unsafe virtual void SendSocket(TDefaultMessage* DefMsg, string sMsg)
        {
            TMsgHeader MsgHdr;
            int nSendBytes;
            byte[] Buff = null;
            const string sExceptionMsg = "{异常} TPlayObject::SendSocket..";
            try
            {
                MsgHdr = new TMsgHeader();
                MsgHdr.dwCode = Grobal2.RUNGATECODE;
                MsgHdr.nSocket = m_nSocket;
                MsgHdr.wGSocketIdx = (short)m_nGSocketIdx;
                MsgHdr.wIdent = Common.GM_DATA;
                if (DefMsg != null)
                {
                    if (sMsg != "")
                    {
                        byte[] bMsg = HUtil32.StringToByteAry(sMsg);
                        MsgHdr.nLength = bMsg.Length + sizeof(TDefaultMessage) + 1;
                        nSendBytes = MsgHdr.nLength + sizeof(TMsgHeader);
                        Buff = new byte[nSendBytes + sizeof(int)];
                        fixed (byte* pb = Buff)
                        {
                            *(int*)pb = nSendBytes;
                            *(TMsgHeader*)(pb + sizeof(int)) = MsgHdr;
                            *(TDefaultMessage*)(pb + sizeof(int) + sizeof(TMsgHeader)) = *DefMsg;

                            Array.Copy(bMsg, 0, Buff, sizeof(TDefaultMessage) + sizeof(TMsgHeader) + sizeof(int), bMsg.Length);
                            Buff[Buff.Length - 1] = 0;
                        }
                    }
                    else
                    {
                        MsgHdr.nLength = sizeof(TDefaultMessage);
                        nSendBytes = MsgHdr.nLength + sizeof(TMsgHeader);
                        Buff = new byte[nSendBytes + sizeof(int)];
                        fixed (byte* pb = Buff)
                        {
                            *(int*)pb = nSendBytes;
                            *(TMsgHeader*)(pb + sizeof(int)) = MsgHdr;
                            *(TDefaultMessage*)(pb + sizeof(int) + sizeof(TMsgHeader)) = *DefMsg;
                        }
                    }
                }
                else
                {
                    if (sMsg != "")
                    {
                        byte[] bMsg = HUtil32.StringToByteAry(sMsg);
                        MsgHdr.nLength = -(bMsg.Length + 1);
                        nSendBytes = Math.Abs(MsgHdr.nLength) + sizeof(TMsgHeader);
                        Buff = new byte[nSendBytes + sizeof(int)];
                        fixed (byte* pb = Buff)
                        {
                            *(int*)pb = nSendBytes;
                            *(TMsgHeader*)(pb + sizeof(int)) = MsgHdr;
                            Array.Copy(bMsg, 0, Buff, sizeof(TMsgHeader) + sizeof(int), bMsg.Length);
                            Buff[Buff.Length - 1] = 0;
                        }
                    }
                }
                if (!M2Share.RunSocket.AddGateBuffer(m_nGateIdx, Buff))
                {
                    Dispose(Buff);
                    Buff = null;
                }
            }
            catch
            {
                M2Share.MainOutMessage(sExceptionMsg);
            }
        }

        /// <summary>
        /// 发送消息
        /// </summary>
        /// <param name="wIdent"></param>
        /// <param name="nRecog"></param>
        /// <param name="nParam"></param>
        /// <param name="nTag"></param>
        /// <param name="nSeries"></param>
        /// <param name="sMsg"></param>
        public virtual void SendDefMessage(int wIdent, int nRecog, long nParam, long nTag, int nSeries, string sMsg)
        {
            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(wIdent, nRecog, nParam, nTag, nSeries, 0);
            if (sMsg != "" && sMsg != null)
            {
                SendSocket(this.m_DefMsg, EncryptUnit.EncodeString(sMsg));
            }
            else
            {
                SendSocket(this.m_DefMsg, "");
            }
        }

        /// <summary>
        /// 客户端查询玩家名称
        /// </summary>
        /// <param name="Target"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        private void ClientQueryUserName(TBaseObject Target, int x, int y)
        {
            string uname;
            int TagColor;
            if (this.CretInNearXY(Target, x, y))
            {
                TagColor = this.GetCharColor(Target);
                m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_USERNAME, Target.ToInt(), TagColor, 0, 0, 0);
                uname = Target.GetShowName();
                SendSocket(this.m_DefMsg, EncryptUnit.EncodeString(uname));
            }
            else
            {
                SendDefMessage(Grobal2.SM_GHOST, Target.ToInt(), x, y, 0, "");
            }
        }

        /// <summary>
        /// 刷新玩家状态
        /// </summary>
        public void RefUserState()
        {
            int n8 = 0;
            if (this.m_PEnvir.m_boFightZone || this.m_PEnvir.m_boFight2Zone)
            {
                n8 = n8 | 1;
            }
            if (this.m_PEnvir.m_boSAFE)
            {
                n8 = n8 | 2;
            }
            if (this.m_boInFreePKArea)
            {
                n8 = n8 | 4;
            }
            SendDefMessage(Grobal2.SM_AREASTATE, n8, 0, 0, 0, "");
        }

        public void RefMyStatus()
        {
            RecalcAbilitys();
            this.CompareSuitItem(false);// 套装
            this.SendMsg(this, Grobal2.RM_MYSTATUS, 0, 0, 0, 0, "");
        }

        public unsafe override bool Operate(TProcessMessage ProcessMsg)
        {
            bool result = true;
            TCharDesc CharDesc;
            int nObjCount;
            string s1C = string.Empty;
            TMessageBodyWL MessageBodyWL;
            TMessageBodyW MessageBodyW;
            TShortMessage ShortMessage;
            TOAbility* OAbility = null;
            uint dwDelayTime = 0;
            int nMsgCount;
            ushort nCode = 0;
            byte[] data = null;
            try
            {
                if (ProcessMsg == null)
                {
                    result = false;
                    return result;
                }
                nCode = 1;
                result = false;
                if (FServerProcess.ContainsKey(ProcessMsg.wIdent))
                {
                    FServerProcess[ProcessMsg.wIdent](ProcessMsg, ref result);
                }
                switch (ProcessMsg.wIdent)
                {
                    case Grobal2.CM_RECALLHERO:// 召唤英雄
                        nCode = 2;
                        if (ProcessMsg.nParam2 == 8)
                        {
                            ClientRecallDeputyHero();
                        }
                        else
                        {
                            ClientRecallHero();
                        }
                        break;
                    case Grobal2.CM_HEROLOGOUT:// 英雄退出
                        nCode = 3;
                        ClientHeroLogOut(0);
                        break;
                    case Grobal2.CM_QUERYHEROBAGITEMS:// 刷新英雄的包裹
                        nCode = 4;
                        if (m_MyHero != null)
                        {
                            ((THeroObject)(m_MyHero)).ClientQueryBagItems();// 发送英雄包裹
                            this.SendMsg(this, Grobal2.RM_SENDHEROUSEITEMS, 0, 0, 0, 0, "");// 发送英雄身上装备
                            this.SendMsg(this, Grobal2.RM_SENDHEROMYMAGIC, 0, 0, 0, 0, "");// 发送英雄使用魔法
                            this.SendMsg(this, Grobal2.RM_QUERYHEROBAGCOUNT, 0, ((THeroObject)(m_MyHero)).m_nItemBagCount, 0, 0, "");// 发送英雄包裹容量
                            ((THeroObject)(m_MyHero)).SendMsg(m_MyHero, Grobal2.RM_HEROABILITY, 0, 0, 0, 0, "");// 发送英雄属性  
                            ((THeroObject)(m_MyHero)).SendMsg(m_MyHero, Grobal2.RM_HEROSUBABILITY, 0, 0, 0, 0, "");// 发送英雄属性
                        }
                        break;
                    case Grobal2.CM_HEROAUTOOPENDEFENCE:// 客户端设置英雄持续开盾
                        if (m_MyHero != null)
                        {
                            ((THeroObject)(m_MyHero)).boAutoOpenDefence = ProcessMsg.nParam1 == 1;
                            if (((THeroObject)(m_MyHero)).boAutoOpenDefence)
                            {
                                this.SysMsg("(英雄)已开启持久开盾", TMsgColor.c_Blue, TMsgType.t_Hint);
                            }
                        }
                        break;
                    case Grobal2.CM_HEROMAGICKEYCHANGE:// 客户端设置英雄魔法开关
                        nCode = 3;
                        if (m_MyHero != null)
                        {
                            ((THeroObject)(m_MyHero)).ChangeHeroMagicKey(ProcessMsg.nParam1, ProcessMsg.nParam2);
                        }
                        break;
                    case Grobal2.CM_QUERYHEROBAGCOUNT:
                        nCode = 4;
                        if (m_MyHero != null)
                        {
                            this.SendMsg(this, Grobal2.RM_QUERYHEROBAGCOUNT, 0, ((THeroObject)(m_MyHero)).m_nItemBagCount, 0, 0, "");// 发送英雄包裹容量
                        }
                        break;
                    case Grobal2.CM_HEROTAKEONITEM:// 英雄穿装备
                        nCode = 5;
                        ClientHeroTakeOnItems((byte)ProcessMsg.nParam2, ProcessMsg.nParam1, ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_HEROTAKEOFFITEM:// 8103
                        nCode = 6;
                        ClientHeroTakeOffItems((byte)ProcessMsg.nParam2, ProcessMsg.nParam1, ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_TAKEOFFITEMHEROBAG:
                    case Grobal2.CM_TAKEOFFITEMTOMASTERBAG:// 装备脱下到英雄包裹 //装备脱下到主人包裹
                        nCode = 7;
                        ClientHeroTakeOffItemsToBag(ProcessMsg.wIdent, (byte)ProcessMsg.nParam2, ProcessMsg.nParam1, ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_SENDITEMTOMASTERBAG:
                    case Grobal2.CM_SENDITEMTOHEROBAG:// 主人包裹到英雄包裹 //英雄包裹到主人包裹
                        nCode = 8;
                        ClientBagToBag(ProcessMsg.wIdent, ProcessMsg.nParam1, ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_HEROTAKEONITEMFORMMASTERBAG:
                    case Grobal2.CM_TAKEONITEMFORMHEROBAG:// 从主人包裹穿装备到英雄包裹 //从英雄包裹穿装备到主人包裹
                        nCode = 9;
                        ClientTakeOnItemsFormBag(ProcessMsg.wIdent, (byte)ProcessMsg.nParam2, ProcessMsg.nParam1, ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_HEROEAT:// 5043
                        nCode = 10;
                        ClientHeroUseItems(ProcessMsg.nParam1, ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_HEROCHGSTATUS:// 改变英雄状态
                        nCode = 11;
                        ClientChgHeroStatus();
                        break;
                    case Grobal2.CM_HEROPROTECT:// 英雄守护
                        nCode = 12;
                        ClientHeroProtect(ProcessMsg.nParam2, ProcessMsg.nParam3);
                        break;
                    case Grobal2.CM_HEROATTACKTARGET:// 锁定目标
                        nCode = 13;
                        ClientHeroAttack(HUtil32.IntToObject<TBaseObject>(ProcessMsg.nParam1), ProcessMsg.nParam2, ProcessMsg.nParam3);
                        break;
                    case Grobal2.CM_QUERYUSERLEVELSORT:// 用户排名
                        nCode = 14;
                        ClientGetUserOrder(ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3);
                        break;
                    case Grobal2.CM_OPENSHOP:
                        // ---------------------------商铺---------------------------------------------
                        // 打开商铺
                        nCode = 277;
                        ClientGetShopItemList(ProcessMsg.nParam2, ProcessMsg.nParam3);
                        break;
                    case Grobal2.RM_OPENSHOP:// 打开商铺
                        nCode = 278;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SENGSHOPITEMS, ProcessMsg.wParam, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_OPENSHOPSpecially:
                        nCode = 279;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SENGSHOPSPECIALLYITEMS, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, ProcessMsg.wParam, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_BUYSHOPITEM:// //购买商铺物品
                        nCode = 280;
                        if (HUtil32.GetTickCount() - m_dwUserTick[1] >= 500)
                        {
                            m_dwUserTick[1] = HUtil32.GetTickCount();
                            ClientBuyShopItem(ProcessMsg.sMsg);
                        }
                        else
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_EXCHANGEGAMEGIRD_FAIL, 0, 0, 0, 0, 0);
                            SendSocket(this.m_DefMsg, EncryptUnit.EncodeString("[失败]购买速度过快!"));
                        }
                        break;
                    case Grobal2.RM_BUYSHOPITEM_FAIL:// 购买商铺物品失败
                        nCode = 281;
                        switch (ProcessMsg.nParam1)
                        {
                            case 1:
                                ProcessMsg.sMsg = "[失败]你的 " + GameConfig.sGameGoldName + " 不够无法购买 " + ProcessMsg.sMsg;
                                break;
                            case 2:
                                ProcessMsg.sMsg = "[失败]你的包裹已满，请清理后在购买 " + ProcessMsg.sMsg;
                                break;
                            case 3:
                                ProcessMsg.sMsg = "[失败]没有找到 " + ProcessMsg.sMsg;
                                break;
                        }
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_BUYSHOPITEM_FAIL, 0, 0, 0, 0, 0);
                        SendSocket(this.m_DefMsg, EncryptUnit.EncodeString(ProcessMsg.sMsg));
                        break;
                    case Grobal2.CM_BUYSHOPITEMGIVE:// 商铺赠送
                        nCode = 282;
                        if (HUtil32.GetTickCount() - m_dwUserTick[1] >= 500)
                        {
                            m_dwUserTick[1] = HUtil32.GetTickCount();
                            ClientBuyShopItemGive(ProcessMsg.sMsg);
                        }
                        else
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_EXCHANGEGAMEGIRD_FAIL, 0, 0, 0, 0, 0);
                            SendSocket(this.m_DefMsg, EncryptUnit.EncodeString("[失败]赠送速度过快!"));
                        }
                        break;
                    case Grobal2.RM_BUYSHOPITEMGIVE_SUCCESS:// 商铺赠送成功
                        nCode = 283;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_BUYSHOPITEMGIVE_SUCCESS, 0, 0, 0, 0, 0);
                        SendSocket(this.m_DefMsg, EncryptUnit.EncodeString(ProcessMsg.sMsg));
                        break;
                    case Grobal2.RM_BUYSHOPITEMGIVE_FAIL:// 商铺赠送失败
                        nCode = 284;
                        switch (ProcessMsg.nParam1)
                        {
                            case 1:
                                ProcessMsg.sMsg = "[失败]你的 " + GameConfig.sGameGoldName + " 不够无法赠送 " + ProcessMsg.sMsg;
                                break;
                            case 2:
                                ProcessMsg.sMsg = "[失败]没有找到 " + ProcessMsg.sMsg;
                                break;
                            case 3:
                                ProcessMsg.sMsg = "[失败]你朋友的包裹已满，请通知你朋友清理后在购赠送 " + ProcessMsg.sMsg;
                                break;
                            case 4:
                                ProcessMsg.sMsg = "[失败]你的朋友 " + ProcessMsg.sMsg + " 没有在线！";
                                break;
                        }
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_BUYSHOPITEMGIVE_FAIL, 0, 0, 0, 0, 0);
                        SendSocket(this.m_DefMsg, EncryptUnit.EncodeString(ProcessMsg.sMsg));
                        break;
                    case Grobal2.CM_EXCHANGEGAMEGIRD:// 兑换灵符
                        nCode = 285;
                        if (HUtil32.GetTickCount() - m_dwUserTick[1] >= 500)
                        {
                            m_dwUserTick[1] = HUtil32.GetTickCount();
                            ClientExchangeGameGird(ProcessMsg.nParam2);
                        }
                        else
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_EXCHANGEGAMEGIRD_FAIL, 0, 0, 0, 0, 0);
                            SendSocket(m_DefMsg, EncryptUnit.EncodeString("[失败]兑换过快!"));
                            SendSocket(this.m_DefMsg, EncryptUnit.EncodeString("[失败]兑换过快!"));
                        }
                        break;
                    case Grobal2.RM_EXCHANGEGAMEGIRD_SUCCESS:// 兑换灵符成功
                        nCode = 287;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_EXCHANGEGAMEGIRD_SUCCESS, 0, 0, 0, 0, 0);
                        SendSocket(this.m_DefMsg, EncryptUnit.EncodeString(ProcessMsg.sMsg));
                        break;
                    case Grobal2.RM_EXCHANGEGAMEGIRD_FAIL:// 兑换灵符失败
                        nCode = 286;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_EXCHANGEGAMEGIRD_FAIL, 0, 0, 0, 0, 0);
                        SendSocket(this.m_DefMsg, EncryptUnit.EncodeString(ProcessMsg.sMsg));
                        break;
                    case Grobal2.CM_HERODROPITEM:
                        // ---------------------------------------------------------------------------
                        nCode = 15;
                        if (m_MyHero != null)
                        {
                            if (((THeroObject)(m_MyHero)).ClientDropItem(ProcessMsg.sMsg, ProcessMsg.nParam1))
                            {
                                SendDefMessage(Grobal2.SM_HERODROPITEM_SUCCESS, ProcessMsg.nParam1, 0, 0, 0, ProcessMsg.sMsg);
                            }
                            else
                            {
                                SendDefMessage(Grobal2.SM_HERODROPITEM_FAIL, ProcessMsg.nParam1, 0, 0, 0, ProcessMsg.sMsg);
                            }
                        }
                        break;
                    case Grobal2.CM_HEROGOTETHERUSESPELL:// 接收到客户传来发合击的消息
                        nCode = 16;
                        if (m_MyHero != null)
                        {
                            ClientHeroUseSpell();
                        }
                        break;
                    case Grobal2.CM_REPAIRFIRDRAGON:// 修补火龙之心
                        nCode = 17;
                        if (m_MyHero != null)
                        {
                            ((THeroObject)(m_MyHero)).RepairFirDragon((byte)ProcessMsg.nParam2, ProcessMsg.nParam1, ProcessMsg.sMsg);
                        }
                        break;
                    case Grobal2.CM_REPAIRDRAGON:// 祝福罐.魔令包功能
                        nCode = 18;
                        RepairDragon((byte)ProcessMsg.nParam2, ProcessMsg.nParam1, ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_REPAIRFINEITEM:// 修补火云石
                        nCode = 19;
                        RepairRefineItem(ProcessMsg.nParam1, ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_OPENBOXS:// 打开宝箱 清清
                        nCode = 20;
                        ClientSendBoxItem(ProcessMsg.nParam1, ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_MOVEBOXS:
                        nCode = 21;
                        ClientGetBoxs();
                        break;
                    case Grobal2.CM_GETBOXS:
                        nCode = 22;
                        ClientGetBoxsItme();
                        break;
                    case Grobal2.CM_SELGETHERO://酒馆 取回英雄 
                        nCode = 23;
                        ClientGETHERO(ProcessMsg.sMsg, (byte)ProcessMsg.nParam1);
                        break;
                    case Grobal2.CM_USERPLAYDRINKITEM:
                        nCode = 24;
                        ClientPlayDrinkItem(ProcessMsg.nParam1, HUtil32.MakeLong(ProcessMsg.nParam2, ProcessMsg.nParam3), ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_PlAYDRINKGAME:// 猜拳码数
                        nCode = 25;
                        ClientPlayDrinkToDrink(ProcessMsg.nParam1, (byte)ProcessMsg.nParam2);
                        break;
                    case Grobal2.CM_DrinkUpdateValue:// 改变酒精度
                        nCode = 26;
                        ClientDrinkUpdateValue(ProcessMsg.nParam1, (byte)ProcessMsg.nParam2, (byte)ProcessMsg.nParam3);
                        break;
                    case Grobal2.CM_USERPLAYDRINK:// 请酒
                        nCode = 27;
                        ClientPlayDrink(ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_BEGINMAKEWINE:
                        // -------------------------酿酒系统---------------------------------------------
                        // 开始酿酒(即把材料全放上窗口)
                        nCode = 28;
                        ClientPlayMakeWine((byte)ProcessMsg.wParam, ProcessMsg.sMsg);// 为物品ID号
                        break;
                    case Grobal2.RM_GETBOXS:
                        // ------------------------------------------------------------------------------
                        nCode = 29;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_GETBOXS, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, ProcessMsg.wParam, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_MOVEBOXS:
                        nCode = 30;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_MOVEBOXS, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, ProcessMsg.wParam, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_OPENBOXS_FAIL:
                        nCode = 31;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_OPENBOXS_FAIL, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, ProcessMsg.wParam, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_SELLOFFCANCEL:// 元宝寄售取消出售
                        nCode = 32;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SellOffCANCEL, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, ProcessMsg.wParam, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_SELLOFFADDITEM_OK:// 客户端往出售物品窗口里加物品 成功
                        nCode = 33;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SELLOFFADDITEM_OK, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, ProcessMsg.wParam, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_SellOffADDITEM_FAIL:// 客户端往出售物品窗口里加物品 失败
                        nCode = 34;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SellOffADDITEM_FAIL, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, ProcessMsg.wParam, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_SELLOFFDELITEM_OK:// 客户端删除出售物品窗里的物品 成功
                        nCode = 35;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SELLOFFDELITEM_OK, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, ProcessMsg.wParam, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_SELLOFFDELITEM_FAIL:// 客户端删除出售物品窗里的物品 失败
                        nCode = 36;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SELLOFFDELITEM_FAIL, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, ProcessMsg.wParam, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_SELLOFFEND_OK:// 客户端元宝寄售结束 成功
                        nCode = 37;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SELLOFFEND_OK, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, ProcessMsg.wParam, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_SELLOFFEND_FAIL:// 客户端元宝寄售结束 失败
                        nCode = 38;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SELLOFFEND_FAIL, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, ProcessMsg.wParam, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_SELLOFFBUY_OK:// 购买成功
                        nCode = 39;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SELLOFFBUY_OK, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, ProcessMsg.wParam, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_OPENBOXS:// 打开宝箱
                        nCode = 40;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_OPENBOXS, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, ProcessMsg.wParam, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_OPENDRAGONBOXS:// 卧龙开宝箱
                        nCode = 41;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_OPENDRAGONBOXS, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, ProcessMsg.wParam, 0);
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_QUERYREFINEITEM:// NPC打开淬炼窗口
                        nCode = 42;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_QUERYREFINEITEM, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, ProcessMsg.wParam, 0);
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_HEROWINEXP:
                        nCode = 43;
                        if (((THeroObject)(m_MyHero)) != null)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_HEROWINEXP, (int)((THeroObject)(m_MyHero)).m_Abil.Exp,
                                HUtil32.LoWord(ProcessMsg.nParam1), HUtil32.HiWord(ProcessMsg.nParam1), 0, 0);
                            SendSocket(this.m_DefMsg, "");
                        }
                        break;
                    case Grobal2.RM_HEROLEVELUP:// 英雄升级
                        nCode = 44;
                        if (m_MyHero != null)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_HEROLEVELUP, (int)m_MyHero.m_Abil.Exp, m_MyHero.m_Abil.Level, 0, 0, 0);
                            SendSocket(this.m_DefMsg, "");
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_HEROABILITY, m_MyHero.m_btGender, 0, m_MyHero.m_btJob, ((THeroObject)(m_MyHero)).m_nLoyal, 0);
                            data = new byte[sizeof(TAbility)];
                            fixed (byte* pb = data)
                            {
                                *(TAbility*)pb = m_MyHero.m_WAbil;
                            }
                            SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TAbility)));
                            SendDefMessage(Grobal2.SM_HEROSUBABILITY, HUtil32.MakeLong(HUtil32.MakeWord((byte)m_MyHero.m_nAntiMagic, 0), 0),
                                HUtil32.MakeWord(m_MyHero.m_btHitPoint, m_MyHero.m_btSpeedPoint), HUtil32.MakeWord((byte)m_MyHero.m_btAntiPoison, (byte)m_MyHero.m_nPoisonRecover),
                                HUtil32.MakeWord((byte)m_MyHero.m_nHealthRecover, (byte)m_MyHero.m_nSpellRecover), "");
                        }
                        break;
                    case Grobal2.RM_HEROABILITY:
                        nCode = 45;
                        if (m_MyHero != null)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_HEROABILITY, m_MyHero.m_btGender, 0, m_MyHero.m_btJob, ((THeroObject)(m_MyHero)).m_nLoyal, 0);
                            data = new byte[sizeof(TAbility)];
                            fixed (byte* pb = data)
                            {
                                *(TAbility*)pb = m_MyHero.m_WAbil;
                            }
                            SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TAbility)));
                        }
                        break;
                    case Grobal2.RM_RECALLHERO:// 召唤英雄
                        nCode = 46;
                        SendDefMessage(Grobal2.SM_RECALLHERO, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, ProcessMsg.wParam, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_CREATEHERO:// 创建英雄
                        nCode = 47;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_CREATEHERO, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                        CharDesc.feature = HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject).GetFeature(this);
                        CharDesc.Status = HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject).m_nCharStatus;
                        data = new byte[sizeof(TCharDesc)];
                        fixed (byte* pb = data)
                        {
                            *(TCharDesc*)pb = CharDesc;
                        }
                        SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TCharDesc)));
                        break;
                    case Grobal2.RM_DESTROYHERO:// 英雄销毁
                        nCode = 48;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_DESTROYHERO, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_MAKEGHOSTHERO:
                        nCode = 49;
                        if (m_MyHero != null)
                        {
                            m_MyHero.m_boDeath = true;
                            m_MyHero.m_dwDeathTick = HUtil32.GetTickCount();
                            m_MyHero.MakeGhost();
                            m_MyHero = null;
                        }
                        break;
                    case Grobal2.RM_SENDHEROUSEITEMS:// 发送英雄身上装备
                        nCode = 50;
                        if (m_MyHero != null)
                        {
                            ((THeroObject)(m_MyHero)).SendUseitems();
                        }
                        break;
                    case Grobal2.RM_HEROWEIGHTCHANGED:
                        nCode = 51;
                        if (m_MyHero == null)
                        {
                            return result;
                        }
                        SendDefMessage(Grobal2.SM_HEROWEIGHTCHANGED, m_MyHero.m_WAbil.Weight, m_MyHero.m_WAbil.WearWeight, m_MyHero.m_WAbil.HandWeight, 0, "");
                        break;
                    case Grobal2.RM_HERODEATH:// 英雄死亡
                        nCode = 52;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_HERODEATH, ProcessMsg.BaseObject, 0, 0, 0, 0);
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_SENDHEROMYMAGIC:// 发送英雄所学的技能
                        nCode = 53;
                        if (m_MyHero != null)
                        {
                            ((THeroObject)(m_MyHero)).SendUseMagic();
                        }
                        break;
                    case Grobal2.RM_QUERYHEROBAGCOUNT:
                        nCode = 54;
                        SendDefMessage(Grobal2.SM_QUERYHEROBAGCOUNT, ProcessMsg.nParam1, ProcessMsg.nParam2, HUtil32.LoWord(ProcessMsg.nParam3), HUtil32.HiWord(ProcessMsg.nParam3), "");
                        break;
                    case Grobal2.RM_HEROMAGIC_LVEXP:// 英雄魔法升级
                        nCode = 55;
                        SendDefMessage(Grobal2.SM_HEROMAGIC_LVEXP, ProcessMsg.nParam1, ProcessMsg.nParam2, HUtil32.LoWord(ProcessMsg.nParam3), HUtil32.HiWord(ProcessMsg.nParam3), "");
                        break;
                    case Grobal2.RM_HEROSUBABILITY:
                        nCode = 56;
                        if (m_MyHero != null)
                        {
                            SendDefMessage(Grobal2.SM_HEROSUBABILITY, HUtil32.MakeLong(HUtil32.MakeWord((byte)m_MyHero.m_nAntiMagic, 0), 0),
                                HUtil32.MakeWord(m_MyHero.m_btHitPoint, m_MyHero.m_btSpeedPoint), HUtil32.MakeWord((byte)m_MyHero.m_btAntiPoison, (byte)m_MyHero.m_nPoisonRecover),
                                HUtil32.MakeWord((byte)m_MyHero.m_nHealthRecover, (byte)m_MyHero.m_nSpellRecover), "");
                        }
                        break;
                    case Grobal2.CM_QUERYUSERNAME:// 80
                        nCode = 57;
                        ClientQueryUserName(HUtil32.IntToObject<TBaseObject>(ProcessMsg.nParam1), ProcessMsg.nParam2, ProcessMsg.nParam3);
                        break;
                    case Grobal2.CM_QUERYBAGITEMS:// 刷新人物的包裹物品
                        nCode = 58;
                        ClientQueryBagItems();
                        break;
                    case Grobal2.CM_QUERYUSERSTATE:// 查看角色装备
                        nCode = 59;
                        ClientQueryUserState(HUtil32.IntToObject<TBaseObject>(ProcessMsg.nParam1), ProcessMsg.nParam2, ProcessMsg.nParam3);
                        break;
                    case Grobal2.CM_DROPITEM:// 丢弃物品消息
                        nCode = 61;
                        if (ClientDropItem(ProcessMsg.sMsg, ProcessMsg.nParam1))
                        {
                            SendDefMessage(Grobal2.SM_DROPITEM_SUCCESS, ProcessMsg.nParam1, 0, 0, 0, ProcessMsg.sMsg);
                        }
                        else
                        {
                            SendDefMessage(Grobal2.SM_DROPITEM_FAIL, ProcessMsg.nParam1, 0, 0, 0, ProcessMsg.sMsg);
                        }
                        break;
                    case Grobal2.CM_PICKUP:// 拾取物品消息
                        nCode = 62;
                        if ((this.m_nCurrX == ProcessMsg.nParam2) && (this.m_nCurrY == ProcessMsg.nParam3))
                        {
                            ClientPickUpItem();
                        }
                        break;
                    case Grobal2.CM_OPENDOOR:// 开门,人物走到地图的某个过门点时
                        nCode = 63;
                        ClientOpenDoor(ProcessMsg.nParam2, ProcessMsg.nParam3);
                        break;
                    case Grobal2.CM_TAKEONITEM:// 1003 从包裹里穿装备
                        nCode = 64;
                        ClientTakeOnItems((byte)ProcessMsg.nParam2, ProcessMsg.nParam1, ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_TAKEOFFITEM:// 1004
                        nCode = 65;
                        ClientTakeOffItems((byte)ProcessMsg.nParam2, ProcessMsg.nParam1, ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_EAT:// 1006
                        nCode = 66;
                        ClientUseItems(ProcessMsg.nParam1, ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_MAGICKEYCHANGE:// 客户端改变魔法快键
                        nCode = 68;
                        ClientChangeMagicKey(ProcessMsg.nParam1, ProcessMsg.nParam2);
                        break;
                    case Grobal2.CM_SOFTCLOSE:// 人物小退
                        nCode = 69;
                        this.m_LastHiter = null;
                        UserEngine.SaveHumanRcd(this);// 保存人物数据
                        if (m_MyHero != null)//人物小退后，英雄直接消失
                        {
                            UserEngine.SaveHeroRcd(this);// 保存英雄数据
                            m_MyHero.m_boDeath = true;
                            ((THeroObject)(m_MyHero)).boCallLogOut = true;// 英雄正常退出
                            m_MyHero.m_dwDeathTick = HUtil32.GetTickCount();
                            m_MyHero.MakeGhost();
                            m_MyHero = null;
                        }
                        m_boReconnection = true;
                        m_boSoftClose = true;
                        break;
                    case Grobal2.CM_CLICKNPC:
                        nCode = 70;
                        ClientClickNPC(ProcessMsg.nParam1);
                        break;
                    case Grobal2.CM_MERCHANTDLGSELECT:
                        nCode = 71;
                        ClientMerchantDlgSelect(ProcessMsg.nParam1, ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_PlAYDRINKDLGSELECT:
                        nCode = 72;
                        ClientPlayDrinkLable(ProcessMsg.nParam1, ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_MERCHANTQUERYSELLPRICE:// 1012
                        nCode = 73;
                        ClientMerchantQuerySellPrice(ProcessMsg.nParam1, HUtil32.MakeLong(ProcessMsg.nParam2, ProcessMsg.nParam3), ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_USERSELLITEM:// 1013
                        nCode = 74;
                        ClientUserSellItem(ProcessMsg.nParam1, HUtil32.MakeLong(ProcessMsg.nParam2, ProcessMsg.nParam3), ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_USERBUYITEM:// 1014
                        nCode = 75;
                        ClientUserBuyItem(ProcessMsg.wIdent, ProcessMsg.nParam1, HUtil32.MakeLong(ProcessMsg.nParam2, ProcessMsg.nParam3), 0, ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_USERGETDETAILITEM:
                        // /////////////////////////增加拍卖////////////////////////////////////////////////////////
                        nCode = 76;
                        ClientUserBuyItem(ProcessMsg.wIdent, ProcessMsg.nParam1, 0, ProcessMsg.nParam2, ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_DROPGOLD:
                        nCode = 77;
                        if (ProcessMsg.nParam1 > 0)
                        {
                            ClientDropGold(ProcessMsg.nParam1);
                        }
                        break;
                    case Grobal2.CM_1017:
                        nCode = 78;
                        SendDefMessage(1, 0, 0, 0, 0, "");
                        break;
                    case Grobal2.CM_GROUPMODE:// 关闭组队
                        nCode = 79;
                        if (ProcessMsg.nParam2 == 0) { ClientGropuClose(); } else { m_boAllowGroup = true; }
                        if (m_boAllowGroup)
                        {
                            SendDefMessage(Grobal2.SM_GROUPMODECHANGED, 0, 1, 0, 0, "");
                        }
                        else
                        {
                            SendDefMessage(Grobal2.SM_GROUPMODECHANGED, 0, 0, 0, 0, "");
                        }
                        break;
                    case Grobal2.CM_CREATEGROUP:// 1020 新建组队
                        nCode = 80;
                        ClientCreateGroup(ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_ADDGROUPMEMBER:// 1021 增加组队人员
                        nCode = 81;
                        ClientAddGroupMember(ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_DELGROUPMEMBER:// 1022
                        nCode = 82;
                        ClientDelGroupMember(ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_USERREPAIRITEM:// 1023
                        nCode = 83;
                        ClientRepairItem(ProcessMsg.nParam1, HUtil32.MakeLong(ProcessMsg.nParam2, ProcessMsg.nParam3), ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_MERCHANTQUERYREPAIRCOST:// 1024
                        nCode = 84;
                        ClientQueryRepairCost(ProcessMsg.nParam1, HUtil32.MakeLong(ProcessMsg.nParam2, ProcessMsg.nParam3), ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_CLICKSIGHICON:
                        nCode = 293;
                        CmdUserCmd(ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_CLICKCRYSTALEXPTOP:// 跳转到QF脚本段
                        nCode = 296;
                        ClientGetExpCrystalData();
                        break;
                    case Grobal2.CM_DEALTRY:// 客户端点击天地结晶，返回经验等信息
                        // ---------------------交易系统--------------------------------------------
                        // 1025 玩家点交易按键
                        nCode = 85;
                        ClientDealTry(ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_DEALADDITEM:// 1026 玩家把物品放到交易框中
                        nCode = 86;
                        ClientAddDealItem(ProcessMsg.nParam1, ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_DEALDELITEM:// 1027 玩家从交易框中取回物品
                        nCode = 87;
                        ClientDelDealItem(ProcessMsg.nParam1, ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_DEALCANCEL:// 1028 玩家取消交易
                        nCode = 88;
                        ClientCancelDeal();
                        break;
                    case Grobal2.CM_DEALCHGGOLD:// 1029 客户端把金币放到交易框中
                        nCode = 89;
                        ClientChangeDealGold(ProcessMsg.nParam1);
                        break;
                    case Grobal2.CM_DEALEND:// 1030 交易结束
                        nCode = 90;
                        ClientDealEnd();
                        break;
                    // ---------------------------挑战系统--------------------------------
                    case Grobal2.CM_CHALLENGETRY:// 玩家点击挑战
                        nCode = 91;
                        ClientChallenge();
                        break;
                    case Grobal2.CM_CHALLENGEADDITEM:// 玩家把物品放到挑战框中
                        nCode = 92;
                        ClientAddChallengeItem(ProcessMsg.nParam1, ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_CHALLENGEDELITEM:// 玩家从挑战框中取回物品
                        nCode = 93;
                        ClientDelChallengeItem(ProcessMsg.nParam1, ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_CHALLENGECANCEL:// 玩家取消挑战
                        nCode = 94;
                        ClientCancelChallenge();
                        break;
                    case Grobal2.CM_CHALLENGECHGGOLD:// 客户端把金币放到挑战框中
                        nCode = 95;
                        ClientChangeChallengeGold(ProcessMsg.nParam1);
                        break;
                    case Grobal2.CM_CHALLENGECHGDIAMOND:// 客户端把金刚石放到挑战框中
                        nCode = 96;
                        ClientChangeChallengeDIAMOND(ProcessMsg.nParam1);
                        break;
                    case Grobal2.CM_CHALLENGEEND:// 挑战抵押物品结束
                        nCode = 97;
                        ClientChallengeEnd();
                        break;
                    case Grobal2.CM_SELLOFFADDITEM:
                        // ==========================元宝寄售系统======================================
                        // 客户端往出售物品窗口里加物品 
                        nCode = 98;
                        ClientAddSellOffItem(ProcessMsg.nParam1, ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_SELLOFFDELITEM:// 客户端删除出售物品窗里的物品 
                        nCode = 99;
                        ClientDelSellOffItem(ProcessMsg.nParam1, ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_SELLOFFCANCEL:// 客户端取消元宝寄售 
                        nCode = 100;
                        ClientCancelSellOff();
                        break;
                    case Grobal2.CM_SELLOFFEND:// 客户端元宝寄售结束
                        nCode = 101;// 买方// 元宝数// 金刚石数// 金刚石特征,类型上限表示
                        ClientSellOffEnd(ProcessMsg.sMsg, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3);
                        break;
                    case Grobal2.CM_CANCELSELLOFFITEMING:// 取消正在寄售的物品 (出售人)
                        nCode = 102;
                        ClientCancelSellOffIng();
                        break;
                    case Grobal2.CM_SELLOFFBUYCANCEL:// 取消寄售 物品购买 (购买人)
                        nCode = 103;// 出售人
                        ClientBuyCancelSellOff(ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_SELLOFFBUY:// 确定购买寄售物品 
                        nCode = 104;// 出售人
                        ClientBuySellOffItme(ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_REFINEITEM:
                        // ============================================================================
                        // 客户端发送粹练物品
                        nCode = 105;
                        if (ClientAddRefineItem(ProcessMsg.sMsg))
                        {
                            ClientRefineItem();
                        }
                        break;
                    case Grobal2.CM_USERSTORAGEITEM:// 1031
                        nCode = 106;
                        ClientStorageItem(ProcessMsg.nParam1, HUtil32.MakeLong(ProcessMsg.nParam2, ProcessMsg.nParam3), ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_USERTAKEBACKSTORAGEITEM:// 1032
                        nCode = 107;
                        ClientTakeBackStorageItem(ProcessMsg.nParam1, HUtil32.MakeLong(ProcessMsg.nParam2, ProcessMsg.nParam3), ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_WANTMINIMAP:// 1033
                        nCode = 108;
                        ClientGetMinMap();
                        break;
                    case Grobal2.CM_USERMAKEDRUGITEM:// 1034
                        nCode = 109;
                        ClientMakeDrugItem(ProcessMsg.nParam1, ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_OPENGUILDDLG:// 1035
                        nCode = 110;
                        ClientOpenGuildDlg();
                        break;
                    case Grobal2.CM_GUILDHOME:// 1036
                        nCode = 111;
                        ClientGuildHome();
                        break;
                    case Grobal2.CM_GUILDMEMBERLIST:
                        nCode = 112;
                        ClientGuildMemberList();
                        break;
                    case Grobal2.CM_GUILDADDMEMBER:
                        nCode = 113;
                        ClientGuildAddMember(ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_GUILDDELMEMBER:
                        nCode = 114;
                        ClientGuildDelMember(ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_GUILDUPDATENOTICE:
                        nCode = 115;
                        ClientGuildUpdateNotice(ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_GUILDUPDATERANKINFO:// 1041 修改行会成员封号,等级
                        nCode = 116;
                        ClientGuildUpdateRankInfo(ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_1042:
                        M2Share.MainOutMessage("[非法数据] " + this.m_sCharName);
                        break;
                    case Grobal2.CM_ADJUST_BONUS:
                        nCode = 117;
                        ClientAdjustBonus(ProcessMsg.nParam1, ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_GUILDALLY:// 1044
                        nCode = 118;
                        ClientGuildAlly();
                        break;
                    case Grobal2.CM_GUILDBREAKALLY:// 1045
                        nCode = 119;
                        ClientGuildBreakAlly(ProcessMsg.sMsg);
                        break;
                    case Grobal2.CM_SAY:
                        nCode = 127;
                        if (ProcessMsg.sMsg != null && ProcessMsg.sMsg != "")
                        {
                            ProcessUserLineMsg(ProcessMsg.sMsg);
                        }
                        break;
                    case Grobal2.CM_USEBATTER:// 使用连击
                        nCode = 8828;
                        if (this.AllowBatterHitSkill(true))// 检测并且打开连击设置位True
                        {
                            this.m_nBatterTarget = HUtil32.IntToObject<TBaseObject>(ProcessMsg.nParam3);
                            this.m_nBatterX = ProcessMsg.nParam1;
                            this.m_nBatterY = ProcessMsg.nParam2;
                            this.m_nBatterDir = (byte)ProcessMsg.nParam3;
                            this.m_boBatterFinally = false;
                            this.m_nBatterUseTick = HUtil32.GetTickCount();
                            this.m_nBatter = 0;
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_BATTERSTART, 0, 0, 0, 0, 0);
                            SendSocket(this.m_DefMsg, "");
                        }
                        break;
                    case Grobal2.CM_QUERYOPENPULSE:
                        ClientQueryOpenPulse((ushort)ProcessMsg.nParam1, (ushort)ProcessMsg.nParam2, false);
                        break;
                    case Grobal2.CM_QUERYHEROOPENPULSE:
                        ClientQueryOpenPulse((ushort)ProcessMsg.nParam1, (ushort)ProcessMsg.nParam2, true);
                        break;
                    case Grobal2.CM_OPENPULSE:
                        break;
                    case Grobal2.CM_RUSHPULSE:
                        ClientRushPulse((ushort)ProcessMsg.nParam1, (ushort)ProcessMsg.nParam2, false);
                        break;
                    case Grobal2.CM_RUSHHEROPULSE:
                        ClientRushPulse((ushort)ProcessMsg.nParam1, (ushort)ProcessMsg.nParam2, true);
                        break;
                    case Grobal2.CM_SETBATTERORDER:
                        this.m_nBatterOrder[0] = (byte)ProcessMsg.nParam2;
                        this.m_nBatterOrder[1] = (byte)ProcessMsg.nParam3;
                        this.m_nBatterOrder[2] = (byte)ProcessMsg.wParam;
                        break;
                    case Grobal2.CM_SETHEROBATTERORDER:
                        if (m_MyHero != null)
                        {
                            m_MyHero.m_nBatterOrder[0] = (byte)ProcessMsg.nParam2;
                            m_MyHero.m_nBatterOrder[1] = (byte)ProcessMsg.nParam3;
                            m_MyHero.m_nBatterOrder[2] = (byte)ProcessMsg.wParam;
                        }
                        break;
                    case Grobal2.CM_CHANGEHEROATTECTMODE:
                        // ==============双英雄相关=============================//
                        if (ProcessMsg.nParam2 >= 0 && ProcessMsg.nParam2 <= 2)
                        {
                            m_btDeputyHeroJob = (byte)ProcessMsg.nParam2;
                        }
                        break;
                    case Grobal2.CM_PASSWORD:
                        nCode = 128;
                        ProcessClientPassword(ProcessMsg);
                        break;
                    case Grobal2.CM_QUERYASSESSHERO:
                        nCode = 10001;
                        ClientQueryAssessHero();
                        break;
                    case Grobal2.CM_ASSESSMENTHERO:
                        nCode = 10002;
                        ClientAssessHero();
                        break;
                    case Grobal2.RM_PULSECHANGED:
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_PULSECHANGED, 0, 0, 0, 0, ProcessMsg.nParam3);
                        //SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(this.m_HumPulses, sizeof(Grobal2.TBatterPulse)));
                        break;
                    case Grobal2.RM_HEROPULSECHANGED:
                        if (m_MyHero != null)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_HEROPULSECHANGED, 0, 0, 0, 0, ProcessMsg.nParam3);
                            //SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(((THeroObject)(m_MyHero)).m_HumPulses, sizeof(Grobal2.TBatterPulse)));
                        }
                        break;
                    case Grobal2.RM_STORMSRATE:
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_STORMSRATE, ProcessMsg.BaseObject, 0, 0, 0, 0);
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_STORMSRATECHANGED:
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_STORMSRATECHANGED, 0, 0, 0, 0, ProcessMsg.nParam3);
                        //SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(((this) as TPlayObject).m_HumStormsRate, sizeof(Grobal2.TStormsRate)));
                        break;
                    case Grobal2.RM_OPENPULSENEEDLEV:
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_OPENPULSENEEDLEV, 0, 0, 0, 0, ProcessMsg.nParam3);
                        //SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(((this) as TPlayObject).m_PulseNeedLev, 20));
                        break;
                    case Grobal2.RM_HEROSTORMSRATECHANGED:
                        if (m_MyHero != null)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_HEROSTORMSRATECHANGED, 0, 0, 0, 0, ProcessMsg.nParam3);
                            //data = new byte[sizeof(TStormsRate)];
                            //fixed (byte* pb = data)
                            //{
                            //    *(TStormsRate*)pb = ((THeroObject)(m_MyHero)).m_HumStormsRate;
                            //}
                            //SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TStormsRate)));
                        }
                        break;
                    case Grobal2.RM_OPENPULSE_OK:
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_OPENPULSE_OK, 0, 0, 0, 0, 0);
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_RUSHPULSE_OK:
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_RUSHPULSE_OK, 0, 0, 0, 0, 0);
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_OPENPULSE_FAIL:
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_OPENPULSE_FAIL, ProcessMsg.wParam, 0, 0, 0, 0);
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_BATTERUSEFINALLY:
                        this.m_nBatterUseTick = HUtil32.GetTickCount();
                        this.SysMsg("连击技结束！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_BATTERUSEFINALLY, 0, 0, 0, 0, 0);
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_RUSHPULSE_FAIL:
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_RUSHPULSE_FAIL, ProcessMsg.wParam, 0, 0, 0, 0);
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_BATTERORDER:
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_BATTERORDER, 0, this.m_nBatterOrder[0], this.m_nBatterOrder[1], this.m_nBatterOrder[2], 0);
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_HEROATTECTMODE:
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_HEROATTECTMODE, 0, m_btDeputyHeroJob, 0, 0, 0);
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_HEROBATTERORDER:
                        if (m_MyHero != null)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_HEROBATTERORDER, 0, ((THeroObject)(m_MyHero)).m_nBatterOrder[0], ((THeroObject)(m_MyHero)).m_nBatterOrder[1], ((THeroObject)(m_MyHero)).m_nBatterOrder[2], 0);
                            SendSocket(this.m_DefMsg, "");
                        }
                        break;

                    case Grobal2.RM_HIT:
                        nCode = 132;
                        if (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject) != this)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_HIT, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                            SendSocket(this.m_DefMsg, "");
                        }
                        break;
                    case Grobal2.RM_PIXINGHIT:// 劈星斩效果
                        nCode = 133;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_PIXINGHIT, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_LEITINGHIT:// 雷霆一击效果
                        nCode = 134;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_LEITINGHIT, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_HEAVYHIT:
                        nCode = 135;
                        if (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject) != this)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_HEAVYHIT, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                            SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        }
                        break;
                    case Grobal2.RM_BIGHIT:
                        nCode = 136;
                        if (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject) != this)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_BIGHIT, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                            SendSocket(this.m_DefMsg, "");
                        }
                        break;
                    case Grobal2.RM_SPELL2:// 10008
                        nCode = 138;
                        if (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject) != this)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_POWERHIT, ProcessMsg.BaseObject,
                                ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                            SendSocket(this.m_DefMsg, "");
                        }
                        break;
                    case Grobal2.RM_MOVEFAIL:
                        nCode = 139;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_MOVEFAIL, this.ToInt(),
                            this.m_nCurrX, this.m_nCurrY, this.m_btDirection, 0);
                        CharDesc.feature = HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject).GetFeatureToLong();
                        CharDesc.Status = HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject).m_nCharStatus;
                        data = new byte[sizeof(TCharDesc)];
                        fixed (byte* pb = data)
                        {
                            *(TCharDesc*)pb = CharDesc;
                        }
                        SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TCharDesc)));
                        break;
                    case Grobal2.RM_LONGHIT:// 10011 刺杀
                        nCode = 140;
                        if (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject) != this)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_LONGHIT, ProcessMsg.BaseObject,
                                ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                            SendSocket(this.m_DefMsg, "");
                        }
                        break;
                    case Grobal2.RM_WIDEHIT:// 10012 半月
                        nCode = 141;
                        if (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject) != this)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_WIDEHIT, ProcessMsg.BaseObject,
                                ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                            SendSocket(this.m_DefMsg, "");
                        }
                        break;
                    case Grobal2.RM_DAILY:// 逐日剑法
                        nCode = 142;
                        if (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject) != this)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_DAILY, ProcessMsg.BaseObject, ProcessMsg.nParam1,
                                ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                            SendSocket(this.m_DefMsg, "");
                        }
                        break;
                    case Grobal2.RM_FIREHIT:// 烈火
                        nCode = 143;
                        if (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject) != this)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_FIREHIT, ProcessMsg.BaseObject, ProcessMsg.nParam1,
                                ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                            SendSocket(this.m_DefMsg, "");
                        }
                        break;
                    case Grobal2.RM_4FIREHIT:// 4级烈火
                        nCode = 144;
                        if (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject) != this)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_4FIREHIT, ProcessMsg.BaseObject, ProcessMsg.nParam1,
                                ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                            SendSocket(this.m_DefMsg, "");
                        }
                        break;
                    case Grobal2.RM_4LONGHIT:// 四级刺杀
                        nCode = 144;
                        if (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject) != this)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_4LONGHIT, ProcessMsg.BaseObject, ProcessMsg.nParam1,
                                ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                            SendSocket(this.m_DefMsg, "");
                        }
                        break;
                    case Grobal2.RM_YUANYUEHIT:// 圆月弯刀
                        nCode = 144;
                        if (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject) != this)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_YUANYUEHIT, ProcessMsg.BaseObject, ProcessMsg.nParam1,
                                ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                            SendSocket(this.m_DefMsg, "");
                        }
                        break;
                    case Grobal2.RM_CRSHIT:// 抱月刀
                        nCode = 145;
                        if (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject) != this)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_CRSHIT, ProcessMsg.BaseObject, ProcessMsg.nParam1,
                                ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                            SendSocket(this.m_DefMsg, "");
                        }
                        break;
                    case Grobal2.RM_41:// 开天斩
                        nCode = 146;
                        if (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject) != this)
                        {
                            switch (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject).m_n42kill)
                            {
                                case 1:// 开天斩重轻击
                                    this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_QTWINHIT, ProcessMsg.BaseObject, ProcessMsg.nParam1,
                                        ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                                    break;
                                case 2:
                                    this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_TWINHIT, ProcessMsg.BaseObject, ProcessMsg.nParam1,
                                        ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                                    break;
                            }
                            SendSocket(this.m_DefMsg, "");
                        }
                        break;
                    case Grobal2.RM_42:// 42
                        nCode = 147;
                        if (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject) != this)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_42, ProcessMsg.BaseObject, ProcessMsg.nParam1,
                                ProcessMsg.nParam2, ProcessMsg.wParam, 0);

                            SendSocket(this.m_DefMsg, "");

                        }
                        break;
                    case Grobal2.RM_43:// 43
                        nCode = 148;
                        if (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject) != this)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_43, ProcessMsg.BaseObject, ProcessMsg.nParam1,
                                ProcessMsg.nParam2, ProcessMsg.wParam, 0);

                            SendSocket(this.m_DefMsg, "");

                        }
                        break;
                    case Grobal2.RM_44://龙影剑法
                        nCode = 149;
                        if (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject) != this)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_CIDHIT, ProcessMsg.BaseObject,
                                ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                            SendSocket(this.m_DefMsg, "");
                        }
                        break;
                    case Grobal2.RM_MONMOVE:// 擒拿手
                        nCode = 150;
                        if (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject) != this)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SITDOWN, ProcessMsg.BaseObject, ProcessMsg.nParam1,
                                ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                            SendSocket(this.m_DefMsg, "");
                        }
                        break;
                    case Grobal2.RM_SANJUEHIT:// 三绝杀
                        nCode = 150;
                        if (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject) != this)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SANJUEHIT, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                            SendSocket(this.m_DefMsg, "");
                        }
                        break;
                    case Grobal2.RM_ZHUIXINHIT:// 追心刺
                        nCode = 150;
                        if (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject) != this)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_ZHUIXINHIT, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, ProcessMsg.nParam3);
                            data = new byte[sizeof(TBatterZhuiXinMessage)];
                            fixed (byte* pb = data)
                            {
                                *(TBatterZhuiXinMessage*)pb = HUtil32.IntToObject<TPlayObject>(ProcessMsg.BaseObject).m_nBatterZhuiXin;
                            }
                            SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TBatterZhuiXinMessage)));
                        }
                        break;
                    case Grobal2.RM_DUANYUEHIT:// 断岳斩
                        nCode = 150;
                        if (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject) != this)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_DUANYUEHIT, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                            SendSocket(this.m_DefMsg, "");
                        }
                        break;
                    case Grobal2.RM_HENGSAOHIT:// 横扫千军
                        nCode = 150;
                        if (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject) != this)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_HENGSAOHIT, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                            SendSocket(this.m_DefMsg, "");
                        }
                        break;
                    case Grobal2.RM_YTPDHIT:// 倚天劈地
                        nCode = 150;
                        if (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject) != this)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_YTPDHIT, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                            SendSocket(this.m_DefMsg, "");
                        }
                        break;
                    case Grobal2.RM_XPYJHIT:// 血魄一击 为不打乱ncode的连续，这儿没有设计改变ncode的值
                        if (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject) != this)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_XPYJHIT, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                            SendSocket(this.m_DefMsg, "");
                        }
                        break;
                    case Grobal2.RM_ZHUIXIN_OK:
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_ZHUIXIN_OK, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, ProcessMsg.wParam);
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_GOTETHERUSESPELL:
                        nCode = 151;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_GOTETHERUSESPELL, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_DISAPPEAR:
                        nCode = 157;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_DISAPPEAR, ProcessMsg.BaseObject, 0, 0, 0, 0);
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_SKELETON:// 10024
                        nCode = 158;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SKELETON, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                        CharDesc.feature = HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject).GetFeature(this);
                        CharDesc.Status = HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject).m_nCharStatus;
                        data = new byte[sizeof(TCharDesc)];
                        fixed (byte* pb = data)
                        {
                            *(TCharDesc*)pb = CharDesc;
                        }
                        SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TCharDesc)));
                        break;
                    case Grobal2.RM_USERNAME:
                        nCode = 159;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_USERNAME, ProcessMsg.BaseObject,
                            this.GetCharColor(HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject)), ProcessMsg.nParam3, 0, 0);
                        SendSocket(this.m_DefMsg, EncryptUnit.EncodeString(ProcessMsg.sMsg));
                        break;
                    case Grobal2.RM_WINEXP:
                        nCode = 160;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_WINEXP, this.m_Abil.Exp, HUtil32.LoWord(ProcessMsg.nParam1), HUtil32.HiWord(ProcessMsg.nParam1), 0, 0);
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_WINNHEXP:// 取得内功经验
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_WINNHEXP, 0, HUtil32.LoWord(ProcessMsg.nParam1), HUtil32.HiWord(ProcessMsg.nParam1), 0, 0);
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_HEROWINNHEXP:// 英雄取得内功经验
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_HEROWINNHEXP, 0, HUtil32.LoWord(ProcessMsg.nParam1), HUtil32.HiWord(ProcessMsg.nParam1), 0, 0);
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_CHANGENAMECOLOR:// 10046 改变名字颜色
                        nCode = 162;
                        if (ProcessMsg.BaseObject != 0)
                        {
                            SendDefMessage(Grobal2.SM_CHANGENAMECOLOR, ProcessMsg.BaseObject, this.GetCharColor(HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject)), 0, 0, "");
                        }
                        break;
                    case Grobal2.RM_PLAYMAKEWINEABILITY:// 酒2相关属性
                        nCode = 266;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_PLAYMAKEWINEABILITY, this.m_WAbil.Alcohol, this.m_WAbil.MaxAlcohol, this.m_WAbil.WineDrinkValue, this.m_WAbil.MedicineValue, 0);
                        SendSocket(this.m_DefMsg, EncryptUnit.EncodeString((this.m_WAbil.MaxMedicineValue).ToString()));
                        break;
                    case Grobal2.RM_HEROMAKEWINEABILITY:// 英雄酒2相关属性
                        if (m_MyHero != null)
                        {
                            nCode = 267;
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_HEROMAKEWINEABILITY, m_MyHero.m_WAbil.Alcohol, m_MyHero.m_WAbil.MaxAlcohol, m_MyHero.m_WAbil.WineDrinkValue, m_MyHero.m_WAbil.MedicineValue, 0);
                            SendSocket(this.m_DefMsg, EncryptUnit.EncodeString((m_MyHero.m_WAbil.MaxMedicineValue).ToString()));
                        }
                        break;
                    case Grobal2.RM_CANEXPLORATION:// 可探索
                        nCode = 268;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_CANEXPLORATION, this.ToInt(), ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.wParam, 0);
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_HEALTHSPELLCHANGED:// 10052   攻击少血与此方法有一定关系
                        nCode = 166;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_HEALTHSPELLCHANGED, ProcessMsg.BaseObject,
                            HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject).m_WAbil.HP,
                            HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject).m_WAbil.MP,
                            HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject).m_WAbil.MaxHP, 0);
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_ITEMSHOW:// 10110
                        nCode = 168;
                        SendDefMessage(Grobal2.SM_ITEMSHOW, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, ProcessMsg.wParam, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_ITEMHIDE:// 10111
                        nCode = 169;
                        SendDefMessage(Grobal2.SM_ITEMHIDE, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, 0, "");
                        break;
                    case Grobal2.RM_DOOROPEN:// 10112
                        nCode = 170;
                        SendDefMessage(Grobal2.SM_OPENDOOR_OK, 0, ProcessMsg.nParam1, ProcessMsg.nParam2, 0, "");
                        break;
                    case Grobal2.RM_DOORCLOSE:// 10113
                        nCode = 171;
                        SendDefMessage(Grobal2.SM_CLOSEDOOR, 0, ProcessMsg.nParam1, ProcessMsg.nParam2, 0, "");
                        break;
                    case Grobal2.RM_SENDUSEITEMS:
                        nCode = 172;
                        SendUseitems();
                        break;
                    case Grobal2.RM_WEIGHTCHANGED:// 10115 重量改变
                        nCode = 173;
                        SendDefMessage(Grobal2.SM_WEIGHTCHANGED, this.m_WAbil.Weight, this.m_WAbil.WearWeight, this.m_WAbil.HandWeight, 0, "");
                        break;
                    case Grobal2.RM_FEATURECHANGED:// 10116
                        nCode = 174;
                        SendDefMessage(Grobal2.SM_FEATURECHANGED, this.ToInt(), HUtil32.LoWord(ProcessMsg.nParam1),
                           HUtil32.HiWord(ProcessMsg.nParam1), ProcessMsg.wParam, "");
                        break;
                    case Grobal2.RM_CLEAROBJECTS:// 10117
                        nCode = 175;
                        SendDefMessage(Grobal2.SM_CLEAROBJECTS, 0, 0, 0, 0, "");
                        break;
                    case Grobal2.RM_MAGICFIRE:// 10120
                        nCode = 178;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_MAGICFIRE, ProcessMsg.BaseObject, HUtil32.LoWord(ProcessMsg.nParam2),
                            HUtil32.HiWord(ProcessMsg.nParam2), ProcessMsg.nParam1, 0);
                        data = new byte[sizeof(int)];
                        fixed (byte* pb = data)
                        {
                            *(int*)pb = ProcessMsg.nParam3;
                        }
                        SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(int)));
                        break;
                    case Grobal2.RM_MAGICFIREFAIL:// 10121
                        nCode = 179;
                        SendDefMessage(Grobal2.SM_MAGICFIRE_FAIL, ProcessMsg.BaseObject, 0, 0, 0, "");
                        break;
                    case Grobal2.RM_SENDMYMAGIC:
                        nCode = 180;
                        SendUseMagic();
                        break;
                    case Grobal2.RM_MAGIC_LVEXP:// 10122
                        nCode = 181;
                        SendDefMessage(Grobal2.SM_MAGIC_LVEXP, ProcessMsg.nParam1, (ushort)ProcessMsg.nParam2, (ushort)HUtil32.LoWord(ProcessMsg.nParam3),
                            (ushort)HUtil32.HiWord(ProcessMsg.nParam3), "");
                        break;
                    case Grobal2.RM_DURACHANGE:// 10125
                        nCode = 182;
                        SendDefMessage(Grobal2.SM_DURACHANGE, ProcessMsg.nParam1, (ushort)ProcessMsg.wParam, (ushort)HUtil32.LoWord(ProcessMsg.nParam2),
                            (ushort)HUtil32.HiWord(ProcessMsg.nParam2), ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_EXPTIMEITEMS:// 聚灵珠 发送时间变化 
                        nCode = 183;// 时间
                        SendDefMessage(Grobal2.SM_EXPTIMEITEMS, ProcessMsg.nParam1, (ushort)ProcessMsg.wParam, (ushort)ProcessMsg.nParam2, 0, "");
                        break;
                    case Grobal2.RM_HERODURACHANGE:// 10125
                        nCode = 184;
                        SendDefMessage(Grobal2.SM_HERODURACHANGE, ProcessMsg.nParam1, (ushort)ProcessMsg.wParam, (ushort)HUtil32.LoWord(ProcessMsg.nParam2),
                            (ushort)HUtil32.HiWord(ProcessMsg.nParam2), "");
                        break;
                    case Grobal2.RM_FIRDRAGONPOINT:
                        nCode = 185;
                        SendDefMessage(Grobal2.SM_FIRDRAGONPOINT, ProcessMsg.nParam1, (ushort)ProcessMsg.wParam, 0, 0, "");
                        break;
                    case Grobal2.RM_MERCHANTDLGCLOSE:// 10127
                        nCode = 186;
                        SendDefMessage(Grobal2.SM_MERCHANTDLGCLOSE, ProcessMsg.nParam1, 0, 0, 0, "");
                        break;
                    case Grobal2.RM_SENDGOODSLIST:
                        nCode = 187;
                        SendDefMessage(Grobal2.SM_SENDGOODSLIST, ProcessMsg.nParam1, (ushort)ProcessMsg.nParam2, 0, 0, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_SENDUSERSELL:// 10129
                        nCode = 188;
                        SendDefMessage(Grobal2.SM_SENDUSERSELL, ProcessMsg.nParam1, ProcessMsg.nParam2, 0, 0, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_CHANGEATTATCKMODE:
                        nCode = 189;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_CHANGEATTATCKMODE, this.ToInt(), 0, 0, 0, 0);
                        SendSocket(this.m_DefMsg, EncryptUnit.EncodeString(ProcessMsg.sMsg));
                        break;
                    case Grobal2.RM_SENDBUYPRICE:// 10130
                        nCode = 190;
                        SendDefMessage(Grobal2.SM_SENDBUYPRICE, ProcessMsg.nParam1, 0, 0, 0, "");
                        break;
                    case Grobal2.RM_USERSELLITEM_OK:// 10131
                        nCode = 191;
                        SendDefMessage(Grobal2.SM_USERSELLITEM_OK, ProcessMsg.nParam1, 0, 0, 0, "");
                        break;
                    case Grobal2.RM_USERSELLITEM_FAIL:// 10132
                        nCode = 192;
                        SendDefMessage(Grobal2.SM_USERSELLITEM_FAIL, ProcessMsg.nParam1, 0, 0, 0, "");
                        break;
                    case Grobal2.RM_BUYITEM_SUCCESS:// 10133
                        nCode = 193;
                        SendDefMessage(Grobal2.SM_BUYITEM_SUCCESS, ProcessMsg.nParam1, HUtil32.LoWord(ProcessMsg.nParam2), HUtil32.HiWord(ProcessMsg.nParam2), 0, "");
                        break;
                    case Grobal2.RM_BUYITEM_FAIL:// 10134
                        nCode = 194;
                        SendDefMessage(Grobal2.SM_BUYITEM_FAIL, ProcessMsg.nParam1, 0, 0, 0, "");
                        break;
                    case Grobal2.RM_SENDDETAILGOODSLIST:// 10135
                        nCode = 195;
                        SendDefMessage(Grobal2.SM_SENDDETAILGOODSLIST, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, 0, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_OPENBOOKS:// 卧龙
                        nCode = 196;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_OPENBOOKS, ProcessMsg.BaseObject, ProcessMsg.nParam1, 0, 0, 0);// 10126
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_Browser:// 连接指定网址
                        nCode = 197;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_Browser, ProcessMsg.BaseObject, 0, 0, 0, 0);// 10126
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_AUTOGOTOXY:// 自动寻路
                        nCode = 198;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_AUTOGOTOXY, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, 0, 0);// 10126
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_OPENMAKEWINE:
                        // -------------------------酿酒系统---------------------------------------------
                        // 打开酿酒窗口
                        nCode = 199;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_OPENMAKEWINE, ProcessMsg.BaseObject, ProcessMsg.nParam1, 0, 0, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_MAKEWINE_OK:// 酿酒成功
                        nCode = 200;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_MAKEWINE_OK, ProcessMsg.BaseObject, ProcessMsg.nParam1, 0, 0, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_MAKEWINE_FAIL:// 酿酒失败
                        nCode = 201;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_MAKEWINE_FAIL, ProcessMsg.BaseObject, ProcessMsg.nParam1, 0, 0, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;

                    case Grobal2.RM_MAGIC68SKILLEXP:// 酒气护体技能经验
                        nCode = 203;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_MAGIC68SKILLEXP, ProcessMsg.BaseObject, 0, 0, 0, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_HEROMAGIC68SKILLEXP:// 英雄酒气护体技能经验 
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_HEROMAGIC68SKILLEXP, ProcessMsg.BaseObject, 0, 0, 0, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_MAGIC69SKILLEXP:// 内功心法经验
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_MAGIC69SKILLEXP, ProcessMsg.BaseObject, ProcessMsg.nParam1,
                            ProcessMsg.nParam2, ProcessMsg.nParam3, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_HEROMAGIC69SKILLEXP:// 英雄内功心法经验
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_HEROMAGIC69SKILLEXP, ProcessMsg.BaseObject, ProcessMsg.nParam1,
                            ProcessMsg.nParam2, ProcessMsg.nParam3, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_MAGIC69SKILLNH:// 内力值(黄条)
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_MAGIC69SKILLNH, ProcessMsg.BaseObject, ProcessMsg.nParam1,
                            ProcessMsg.nParam2, ProcessMsg.nParam3, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_SENDSELLOFFGOODSLIST:
                        // ------------------------------------------------------------------------------
                        // ////////////////////////////////////拍卖//////////////////////////////////////
                        // 拍卖
                        nCode = 205;
                        SendDefMessage(Grobal2.SM_SENDSELLOFFGOODSLIST, ProcessMsg.nParam1, (ushort)ProcessMsg.nParam2, (ushort)ProcessMsg.nParam3, 0, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_SENDUSERSELLOFFITEM:
                        nCode = 206;
                        SendDefMessage(Grobal2.SM_SENDUSERSELLOFFITEM, ProcessMsg.nParam1, (ushort)ProcessMsg.nParam2, 0, 0, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_SENDUSERSELLOFFITEM_OK:
                        nCode = 207;
                        SendDefMessage(Grobal2.SM_SENDUSERSELLOFFITEM_OK, ProcessMsg.nParam1, (ushort)ProcessMsg.nParam2, (ushort)ProcessMsg.nParam3, 0, "");
                        break;
                    case Grobal2.RM_SENDUSERSELLOFFITEM_FAIL:
                        nCode = 208;
                        SendDefMessage(Grobal2.SM_SENDUSERSELLOFFITEM_FAIL, ProcessMsg.nParam1, (ushort)ProcessMsg.nParam2, (ushort)ProcessMsg.nParam3, 0, "");
                        break;
                    case Grobal2.RM_SENDSELLOFFITEMLIST:
                        nCode = 209;
                        SendDefMessage(Grobal2.CM_SENDSELLOFFITEMLIST, ProcessMsg.nParam1, (ushort)ProcessMsg.nParam2, (ushort)ProcessMsg.nParam3, 0, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_SENDBUYSELLOFFITEM_OK:// 购买拍卖物品成功
                        nCode = 210;
                        SendDefMessage(Grobal2.SM_SENDBUYSELLOFFITEM_OK, ProcessMsg.nParam1, (ushort)HUtil32.LoWord(ProcessMsg.nParam2),
                            (ushort)HUtil32.HiWord(ProcessMsg.nParam2), 0, "");
                        break;
                    case Grobal2.RM_SENDBUYSELLOFFITEM_FAIL:// 购买拍卖物品失败
                        nCode = 211;
                        SendDefMessage(Grobal2.SM_SENDBUYSELLOFFITEM_FAIL, ProcessMsg.nParam1, 0, 0, 0, "");
                        break;
                    case Grobal2.RM_HIDESIGHICON:// 隐藏感叹号图标
                        nCode = 294;
                        SendDefMessage(Grobal2.SM_HIDESIGHICON, 0, 0, 0, 0, "");
                        break;
                    case Grobal2.RM_OPENEXPCRYSTAL:// 显示、隐藏天地结晶图标
                        nCode = 295;
                        SendDefMessage(Grobal2.SM_OPENEXPCRYSTAL, ProcessMsg.nParam1, 0, 0, 0, "");
                        break;
                    case Grobal2.RM_SENDDEALOFFFORM:
                        // ---------------------------元宝寄售系统---------------------------------------
                        // 打开出售物品窗口
                        nCode = 212;
                        SendDefMessage(Grobal2.SM_SENDDEALOFFFORM, ProcessMsg.nParam1, (ushort)ProcessMsg.nParam2, 0, 0, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_QUERYYBSELL:// 查询正在出售的物品
                        nCode = 213;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_QUERYYBSELL, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, ProcessMsg.wParam, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_QUERYYBDEAL:// 查询可以的购买物品
                        nCode = 214;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_QUERYYBDEAL, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, ProcessMsg.wParam, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_GOLDCHANGED:// 10136
                        nCode = 215;
                        SendDefMessage(Grobal2.SM_GOLDCHANGED, this.m_nGold, HUtil32.LoWord(m_nGameGold), HUtil32.HiWord(m_nGameGold), 0, "");
                        break;
                    case Grobal2.RM_GAMEGOLDCHANGED:
                        nCode = 216;
                        SendGoldInfo(false);
                        break;
                    case Grobal2.RM_CHANGELIGHT:// 10137
                        nCode = 217;
                        SendDefMessage(Grobal2.SM_CHANGELIGHT, ProcessMsg.BaseObject, HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject).m_nLight, GameConfig.nClientKey, 0, "");
                        break;
                    case Grobal2.RM_LAMPCHANGEDURA:// 10138
                        nCode = 218;
                        SendDefMessage(Grobal2.SM_LAMPCHANGEDURA, ProcessMsg.nParam1, 0, 0, 0, "");
                        break;
                    case Grobal2.RM_CHARSTATUSCHANGED:// 10139
                        nCode = 219;
                        SendDefMessage(Grobal2.SM_CHARSTATUSCHANGED, ProcessMsg.BaseObject, HUtil32.LoWord(ProcessMsg.nParam1),
                            HUtil32.HiWord(ProcessMsg.nParam1), ProcessMsg.wParam, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_GROUPCANCEL:// 10140
                        nCode = 220;
                        SendDefMessage(Grobal2.SM_GROUPCANCEL, ProcessMsg.nParam1, 0, 0, 0, "");
                        break;
                    case Grobal2.RM_SENDUSERREPAIR:
                    case Grobal2.RM_SENDUSERSREPAIR:// 10141
                        nCode = 221;
                        SendDefMessage(Grobal2.SM_SENDUSERREPAIR, ProcessMsg.nParam1, ProcessMsg.nParam2, 0, 0, "");
                        break;
                    case Grobal2.RM_USERREPAIRITEM_OK:// 10143
                        nCode = 222;
                        SendDefMessage(Grobal2.SM_USERREPAIRITEM_OK, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, 0, "");
                        break;
                    case Grobal2.RM_SENDREPAIRCOST:// 10142
                        nCode = 223;
                        SendDefMessage(Grobal2.SM_SENDREPAIRCOST, ProcessMsg.nParam1, 0, 0, 0, "");
                        break;
                    case Grobal2.RM_USERREPAIRITEM_FAIL:// 10144
                        nCode = 224;
                        SendDefMessage(Grobal2.SM_USERREPAIRITEM_FAIL, ProcessMsg.nParam1, 0, 0, 0, "");
                        break;
                    case Grobal2.RM_USERSTORAGEITEM:// 10146
                        nCode = 225;
                        SendDefMessage(Grobal2.SM_SENDUSERSTORAGEITEM, ProcessMsg.nParam1, ProcessMsg.nParam2, 0, 0, "");
                        break;
                    case Grobal2.RM_USERGETBACKITEM:// 10147
                        nCode = 226;
                        SendSaveItemList(ProcessMsg.nParam1);
                        break;
                    case Grobal2.RM_USERBIGGETBACKITEM:// 发送无限仓库物品
                        nCode = 227;
                        SendSaveBigStorageItemList(ProcessMsg.nParam1, ProcessMsg.wParam);
                        break;
                    case Grobal2.RM_SENDDELITEMLIST:// 10148 SM_DELITEMS
                        nCode = 228;
                        if (HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject) == m_MyHero)
                        {
                            ((THeroObject)(m_MyHero)).SendDelItemList((List<string>)HUtil32.IntToObject<List<string>>(ProcessMsg.nParam1));
                        }
                        else
                        {
                            SendDelItemList((List<string>)HUtil32.IntToObject<List<string>>(ProcessMsg.nParam1));
                        }
                        Dispose((List<string>)HUtil32.IntToObject<List<string>>(ProcessMsg.nParam1));
                        break;
                    case Grobal2.RM_USERMAKEDRUGITEMLIST:// 10149
                        nCode = 229;
                        SendDefMessage(Grobal2.SM_SENDUSERMAKEDRUGITEMLIST, ProcessMsg.nParam1, (ushort)ProcessMsg.nParam2, 0, 0, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_MAKEDRUG_SUCCESS:// 10150
                        nCode = 230;
                        SendDefMessage(Grobal2.SM_MAKEDRUG_SUCCESS, ProcessMsg.nParam1, 0, 0, 0, "");
                        break;
                    case Grobal2.RM_MAKEDRUG_FAIL:// 10151
                        nCode = 231;
                        SendDefMessage(Grobal2.SM_MAKEDRUG_FAIL, ProcessMsg.nParam1, 0, 0, 0, "");
                        break;

                    case Grobal2.RM_DIGDOWN:// 10201
                        nCode = 234;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_DIGDOWN, ProcessMsg.BaseObject, ProcessMsg.nParam1,
                            ProcessMsg.nParam2, 0, 0);
                        SendSocket(this.m_DefMsg, "");
                        break;

                    case Grobal2.RM_10205:// 10205
                        nCode = 240;
                        SendDefMessage(Grobal2.SM_716, ProcessMsg.BaseObject, (ushort)ProcessMsg.nParam1, (ushort)ProcessMsg.nParam2, (ushort)ProcessMsg.nParam3, "");
                        break;
                    case Grobal2.RM_CHANGEGUILDNAME:// 10301  SM_CHANGEGUILDNAME
                        nCode = 241;
                        SendChangeGuildName();
                        break;
                    case Grobal2.RM_SUBABILITY:// 10302
                        nCode = 242;
                        SendDefMessage(Grobal2.SM_SUBABILITY, HUtil32.MakeLong(HUtil32.MakeWord((byte)this.m_nAntiMagic, 0), 0),
                            HUtil32.MakeWord(this.m_btHitPoint, this.m_btSpeedPoint),
                            HUtil32.MakeWord((byte)this.m_btAntiPoison, (byte)this.m_nPoisonRecover), HUtil32.MakeWord((byte)this.m_nHealthRecover,
                            (byte)this.m_nSpellRecover), "");
                        break;
                    case Grobal2.RM_BUILDGUILD_OK:// 10303
                        nCode = 243;
                        SendDefMessage(Grobal2.SM_BUILDGUILD_OK, 0, 0, 0, 0, "");
                        break;
                    case Grobal2.RM_BUILDGUILD_FAIL:// 10304
                        nCode = 244;
                        SendDefMessage(Grobal2.SM_BUILDGUILD_FAIL, ProcessMsg.nParam1, 0, 0, 0, "");
                        break;
                    case Grobal2.RM_DONATE_OK:// 10305
                        nCode = 245;
                        SendDefMessage(Grobal2.SM_DONATE_OK, ProcessMsg.nParam1, 0, 0, 0, "");
                        break;
                    case Grobal2.RM_DONATE_FAIL:// 10306
                        nCode = 246;
                        SendDefMessage(Grobal2.SM_DONATE_FAIL, ProcessMsg.nParam1, 0, 0, 0, "");
                        break;
                    case Grobal2.RM_MYSTATUS:
                        nCode = 247;
                        SendDefMessage(Grobal2.SM_MYSTATUS, 0, (ushort)GetMyStatus(), 0, 0, "");
                        break;
                    case Grobal2.RM_MENU_OK:// 10309
                        nCode = 248;
                        SendDefMessage(Grobal2.SM_MENU_OK, ProcessMsg.nParam1, 0, 0, 0, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_SPACEMOVE_FIRE:
                    case Grobal2.RM_SPACEMOVE_FIRE2:// 10330
                        nCode = 249;
                        if (ProcessMsg.wIdent == Grobal2.RM_SPACEMOVE_FIRE)
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SPACEMOVE_HIDE, ProcessMsg.BaseObject, 0, 0, 0, 0);
                        }
                        else
                        {
                            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SPACEMOVE_HIDE2, ProcessMsg.BaseObject, 0, 0, 0, 0);
                        }
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_RECONNECTION:// 10332 重新连接
                        nCode = 251;
                        m_boReconnection = true;
                        SendDefMessage(Grobal2.SM_RECONNECT, 0, 0, 0, 0, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_HIDEEVENT:// 10333
                        nCode = 252;
                        SendDefMessage(Grobal2.SM_HIDEEVENT, ProcessMsg.nParam1, (ushort)ProcessMsg.wParam, (ushort)ProcessMsg.nParam2, (ushort)ProcessMsg.nParam3, "");
                        break;
                    case Grobal2.RM_MYSHOW:// 自身动画消息
                        nCode = 254;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_MYSHOW, ProcessMsg.BaseObject, ProcessMsg.wParam, ProcessMsg.nParam2, ProcessMsg.nParam3, 0);
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_ADJUST_BONUS:
                        nCode = 255;
                        SendAdjustBonus();
                        break;
                    case Grobal2.RM_10401:
                        nCode = 256;
                        ChangeServerMakeSlave((TSlaveInfo)HUtil32.IntToObject<TSlaveInfo>(ProcessMsg.nParam1));
                        Dispose((TSlaveInfo)HUtil32.IntToObject<TSlaveInfo>(ProcessMsg.nParam1));
                        break;
                    case Grobal2.RM_OPENHEALTH:// 10410
                        nCode = 257;
                        SendDefMessage(Grobal2.SM_OPENHEALTH, ProcessMsg.BaseObject, (ushort)HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject).m_WAbil.HP,
                            (ushort)HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject).m_WAbil.MaxHP, 0, "");
                        break;
                    case Grobal2.RM_CLOSEHEALTH:// 10411
                        nCode = 258;
                        SendDefMessage(Grobal2.SM_CLOSEHEALTH, ProcessMsg.BaseObject, 0, 0, 0, "");
                        break;
                    case Grobal2.RM_BREAKWEAPON:// 10413
                        nCode = 259;
                        SendDefMessage(Grobal2.SM_BREAKWEAPON, ProcessMsg.BaseObject, 0, 0, 0, "");
                        break;
                    case Grobal2.RM_10414:// 10414
                        nCode = 260;
                        SendDefMessage(Grobal2.SM_INSTANCEHEALGUAGE, ProcessMsg.BaseObject,
                            (ushort)HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject).m_WAbil.HP, (ushort)HUtil32.IntToObject<TBaseObject>(ProcessMsg.BaseObject).m_WAbil.MaxHP, 0, "");
                        break;

                    case Grobal2.RM_PASSWORD:// 10416
                        nCode = 262;
                        SendDefMessage(Grobal2.SM_PASSWORD, 0, 0, 0, 0, "");
                        break;
                    case Grobal2.RM_PASSWORDSTATUS:
                        nCode = 264;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_PASSWORDSTATUS, ProcessMsg.BaseObject, ProcessMsg.nParam1, ProcessMsg.nParam2, ProcessMsg.nParam3, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_USERLEVELORDER:// 人物排行
                        nCode = 265;
                        UserLevelOrder(ProcessMsg.BaseObject);
                        break;
                    case Grobal2.RM_QUERYUSERLEVELSORT:
                        nCode = 266;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_QUERYUSERLEVELSORT, ProcessMsg.nParam1, ProcessMsg.wParam, ProcessMsg.nParam2, ProcessMsg.nParam3, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_GLORY:// 发送到客户端 荣誉值 
                        nCode = 267;
                        SendGloryInfo();
                        break;
                    case Grobal2.RM_SHOWASSESSDLG:
                        // ---------------------双英雄系统-----------------------------------------------
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SHOWASSESSDLG, ProcessMsg.nParam1, ProcessMsg.wParam, ProcessMsg.nParam2, ProcessMsg.nParam3, 0);
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_OPENTRAININGDLG:
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_OPENTRAININGDLG, ProcessMsg.nParam1, ProcessMsg.wParam, ProcessMsg.nParam2, ProcessMsg.nParam3, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_ISDEHERO:
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_ISDEHERO, ProcessMsg.nParam1, ProcessMsg.wParam, ProcessMsg.nParam2, ProcessMsg.nParam3, 0);
                        SendSocket(this.m_DefMsg, "");
                        break;
                    case Grobal2.RM_GETASSESSHEROINFO:
                        nCode = 268;
                        m_sAssessHeroMsg = ProcessMsg.sMsg;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_GETASSESSHEROINFO, ProcessMsg.nParam1, ProcessMsg.wParam, ProcessMsg.nParam2, ProcessMsg.nParam3, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_QUERYASSESSHERO:
                        nCode = 268;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_QUERYASSESSHERO, ProcessMsg.nParam1, ProcessMsg.wParam, ProcessMsg.nParam2, ProcessMsg.nParam3, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_GETHEROINFO:
                        // ---------------------酒馆系统-------------------------------------------------
                        // 客户端取得酒馆英雄存储信息
                        nCode = 268;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_GETHEROINFO, ProcessMsg.nParam1, ProcessMsg.wParam, ProcessMsg.nParam2, ProcessMsg.nParam3, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_SENDUSERPLAYDRINK:// 发送出现请酒对话框
                        nCode = 269;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SENDUSERPLAYDRINK, ProcessMsg.nParam1, ProcessMsg.wParam, ProcessMsg.nParam2, ProcessMsg.nParam3, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_OPENPLAYDRINK:// 打开界面
                        nCode = 270;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_OPENPLAYDRINK, ProcessMsg.nParam1, ProcessMsg.wParam, ProcessMsg.nParam2, ProcessMsg.nParam3, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_PlayDrinkToDrink:// 送到客户端谁赢谁输
                        nCode = 271;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_PlayDrinkToDrink, ProcessMsg.nParam1, ProcessMsg.wParam, ProcessMsg.nParam2, ProcessMsg.nParam3, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_DrinkUpdateValue:
                        nCode = 272;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_DrinkUpdateValue, ProcessMsg.nParam1, ProcessMsg.wParam, ProcessMsg.nParam2, ProcessMsg.nParam3, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    case Grobal2.RM_CLOSEDRINK:
                        nCode = 273;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_CLOSEDRINK, ProcessMsg.nParam1, ProcessMsg.wParam, ProcessMsg.nParam2, ProcessMsg.nParam3, 0);
                        SendSocket(this.m_DefMsg, ProcessMsg.sMsg);
                        break;
                    default:
                        nCode = 274;
                        result = base.Operate(ProcessMsg);
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.Operate Code:" + nCode);
            }
            return result;
        }

        public unsafe override void Run()
        {
            int tObjCount;
            int nInteger = 0;
            TProcessMessage ProcessMsg = null;
            bool boInSafeArea;
            bool boTakeItem;
            TStdItem* StdItem;
            TUserItem* UserItem;
            TPlayObject PlayObject;
            TPlayObject PushedObject;
            TBaseObject BaseObject;
            TUserCastle Castle;
            IList<TPlayObject> PlayObjectList;
            uint dwStationTick;
            byte nCode = 0;
            int n_mLevelOrder;
            const string sPayMentExpire = "您的帐户充值时间已到期！！！";
            const string sDisConnectMsg = "游戏被强行中断！！！";
            const string sExceptionMsg1 = "{异常} TPlayObject::Run -> Operate 1 Code={0}";
            const string sExceptionMsg2 = "{异常} TPlayObject::Run -> Operate 2 # %s Ident:%d Sender:%d wP:%d nP1:%d nP2:%d np3:%d Msg:%s Code=%d";
            const string sExceptionMsg3 = "{异常} TPlayObject::Run -> GetHighHuman Code:";
            const string sExceptionMsg4 = "{异常} TPlayObject::Run -> ClearObj";
            try
            {
                if (M2Share.g_boExitServer)
                {
                    m_boEmergencyClose = true;
                    m_boPlayOffLine = false;
                    m_boNotOnlineAddExp = false;
                    m_boStartAutoAddExpPoint = false;
                }
            }
            catch
            {
            }
            if (!this.m_boUseBatter)
            {
                if (this.m_boCanUseBatter) // 这里是检测 无需打开连击
                {
                    this.AllowBatterHitSkill(false);
                }
            }
            if (this.m_boUseBatter)
            {
                if ((HUtil32.GetTickCount() - this.m_dwLatestBatterHitTick) < 10000)
                {
                    ClientUseBatter(null);
                }
                else
                {
                    this.m_boUseBatter = false;
                    this.SendMsg(this, Grobal2.RM_BATTERUSEFINALLY, 0, 0, 0, 0, "");
                    if ((this.m_btJob == 1) || (this.m_btJob == 2))
                    {
                        m_boCanSpell = true;// 可以魔法
                        m_boCanWalk = true;
                        m_boCanRun = true;
                        m_boCanHit = true;
                    }
                }
            }
            try
            {
                if ((HUtil32.GetTickCount() - this.m_dwVerifyTick) > 30000)  // 30 * 1000
                {
                    this.m_dwVerifyTick = HUtil32.GetTickCount();// 清组队已死亡成员
                    if (this.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                    {
                        if ((m_GroupOwner != null))
                        {
                            if (m_GroupOwner.m_boDeath || m_GroupOwner.m_boGhost)
                            {
                                m_GroupOwner = null;
                            }
                        }
                        if (m_GroupOwner == this)
                        {
                            for (int I = m_GroupMembers.Count - 1; I >= 0; I--)
                            {
                                if (m_GroupMembers.Count <= 0)
                                {
                                    break;
                                }
                                BaseObject = m_GroupMembers[I];
                                if (BaseObject != null)
                                {
                                    if (BaseObject.m_boDeath || (BaseObject.m_boGhost))
                                    {
                                        m_GroupMembers.RemoveAt(I);
                                    }
                                }
                            }
                        }
                        // 清组队已死亡成员 结束
                        if ((m_DealCreat != null) && (m_DealCreat.m_boGhost))// 检查交易双方 状态
                        {
                            m_DealCreat = null;
                        }
                    }
                    if (!this.m_boDenyRefStatus)
                    {
                        this.m_PEnvir.VerifyMapTime(this.m_nCurrX, this.m_nCurrY, this);// 刷新在地图上位置的时间
                    }
                }
                if (m_boDealing)
                {
                    if ((this.GetPoseCreate() != m_DealCreat) || (m_DealCreat == this) || (m_DealCreat == null))
                    {
                        DealCancel();
                    }
                    nCode = 1;
                }
                if (m_boExpire)// 账号过期
                {
                    this.SysMsg(sPayMentExpire, TMsgColor.c_Red, TMsgType.t_Hint);
                    this.SysMsg(sDisConnectMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                    m_boEmergencyClose = true;
                    m_boPlayOffLine = false;
                    m_boNotOnlineAddExp = false;
                    m_boStartAutoAddExpPoint = false;
                    m_boExpire = false;
                }
                nCode = 2;
                if (m_boNotOnlineAddExp && m_boStartAutoAddExpPoint && (m_nNotOnlineAddExpPoint > 0))// 离线挂机人物 自动增加经验
                {
                    if ((HUtil32.GetTickCount() - m_dwAutoAddExpPointTick) >= 60000)// 1000 * 60
                    {
                        m_dwAutoAddExpPointTick = HUtil32.GetTickCount();
                        GetExp(m_nNotOnlineAddExpPoint, false, 0);
                    }
                    if ((HUtil32.GetTickCount() - m_dwAutoAddExpPointTimeTick) >= m_dwNotOnlineAddExpTime * 1000) // 挂机时间到
                    {
                        m_boPlayOffLine = false;
                        m_boNotOnlineAddExp = false;
                        m_boStartAutoAddExpPoint = false;
                    }
                }
                // ------------------------------------------------------------------------------
                // 玩家等级排名上升或下降,增加或减少英雄忠诚度
                if (!m_boNotOnlineAddExp && (HUtil32.GetTickCount() - dwGetLevelOrderTick > 600000)) // 1000 * 60 * 10
                {
                    dwGetLevelOrderTick = HUtil32.GetTickCount();
                    nCode = 200;
                    n_mLevelOrder = GetUserLevelOrder();// 获取人物等级排名
                    if ((n_mLevelOrder > n_LevelOrder) && (n_LevelOrder != 0))  // 排名下降
                    {
                        if ((m_MyHero != null) && ((m_boHasHero || m_boHasHeroTwo) && (m_sHeroCharName != "")))
                        {
                            ((THeroObject)(m_MyHero)).m_nLoyal = HUtil32._MAX(0, ((THeroObject)(m_MyHero)).m_nLoyal - GameConfig.nLevelOrderDecLoyal);
                        }
                        nCode = 201;
                        this.SysMsg(string.Format(GameMsgDef.sHumLevelOrderDropMsg, n_mLevelOrder, (n_mLevelOrder - n_LevelOrder)), TMsgColor.c_Blue, TMsgType.t_Hint);// 人物排行下降进行提示
                        n_LevelOrder = n_mLevelOrder;
                    }
                    if ((n_mLevelOrder < n_LevelOrder) && (n_LevelOrder != 0)) // 排名上升
                    {
                        if ((m_MyHero != null) && ((m_boHasHero || m_boHasHeroTwo) && (m_sHeroCharName != "")))
                        {
                            ((THeroObject)(m_MyHero)).m_nLoyal = ((THeroObject)(m_MyHero)).m_nLoyal + GameConfig.nLevelOrderIncLoyal;
                            if (((THeroObject)(m_MyHero)).m_nLoyal > 10000)
                            {
                                ((THeroObject)(m_MyHero)).m_nLoyal = 10000;
                            }
                        }
                        n_LevelOrder = n_mLevelOrder;
                    }
                    if (n_LevelOrder == 0)
                    {
                        n_LevelOrder = n_mLevelOrder;
                    }
                }
                nCode = 202;
                if (!this.m_PEnvir.m_boFight4Zone)// 气血石 魔血石,挑战地图不能使用
                {
                    PlaySuperRock();
                }
                // ------------------------------------------------------------------------------
                nCode = 3;
                if (!m_boNotOnlineAddExp) // 如果是离线挂机的，不检测
                {
                    nCode = 42;
                    if (this.m_boFireHitSkill && ((HUtil32.GetTickCount() - this.m_dwLatestFireHitTick) > 20000))    // 20 * 1000
                    {
                        this.m_boFireHitSkill = false;
                        this.SysMsg(GameMsgDef.sSpiritsGone, TMsgColor.c_Red, TMsgType.t_Hint);
                        if (this.m_btRaceServer == Grobal2.RC_HEROOBJECT)
                        {
                            //if ((this.m_MagicFireSwordSkill.btLevel == 4) && (((THeroObject)(this)).m_nLoyal >= GameConfig.nGotoLV4))
                            //{
                            //    SendSocket(null, "+U4FIR"); // 关闭4级烈火
                            //}
                            //else
                            //{
                            //    SendSocket(null, "+UFIR");
                            //}
                        }
                        else
                        {
                            // 不是英雄无需忠诚度提示
                            if ((this.m_MagicFireSwordSkill->btLevel == 4))
                            {
                                SendSocket(null, "+U4FIR");  // 关闭4级烈火
                            }
                            else
                            {
                                SendSocket(null, "+UFIR");
                            }
                        }
                    }
                    // ------------------------------------------------------------------------------
                    nCode = 43;
                    if (this.m_boDailySkill && ((HUtil32.GetTickCount() - this.m_dwLatestDailyTick) > 20000)) // 逐日剑法  20 * 1000
                    {
                        this.m_boDailySkill = false;
                        this.SysMsg(GameMsgDef.sDailySpiritsGone, TMsgColor.c_Red, TMsgType.t_Hint);
                        SendSocket(null, "+UDAILY");
                    }
                    // ------------------------------------------------------------------------------
                    nCode = 44;
                    if (this.m_bo42kill && ((HUtil32.GetTickCount() - this.m_dwLatest42Tick) > 20000)) // 开天斩 20 * 1000
                    {
                        this.m_bo42kill = false;
                        this.SysMsg(GameMsgDef.sSkill42Off, TMsgColor.c_Red, TMsgType.t_Hint);
                        switch (this.m_n42kill)// 判断轻击重击
                        {
                            case 1:
                                SendSocket(null, "+UQTWN"); // 关闭轻开天斩
                                break;
                            case 2:
                                SendSocket(null, "+UTWN"); // 关闭重开天斩
                                break;
                        }
                        this.m_n42kill = 0;
                    }
                    // ------------------------------------------------------------------------------
                    nCode = 44;
                    if (this.m_bo43kill && ((HUtil32.GetTickCount() - this.m_dwLatest43Tick) > 20000)) // 龙影剑法  20* 1000
                    {
                        this.m_bo43kill = false;
                        this.SysMsg(GameMsgDef.sSkill43Off, TMsgColor.c_Red, TMsgType.t_Hint);
                        SendSocket(null, "+UCID");// 停止使用龙影剑法
                    }
                    if (this.m_boYTPDHitSkill && ((HUtil32.GetTickCount() - this.m_dwLatestYTPDHitTick) > 20000)) // 倚天劈地 20 * 1000
                    {
                        this.m_boYTPDHitSkill = false;
                        this.SysMsg(GameMsgDef.sYTPDSpiritsGone, TMsgColor.c_Red, TMsgType.t_Hint);
                        SendSocket(null, "+UYTPD");
                    }
                    if (this.m_boXPYJHitSkill && ((HUtil32.GetTickCount() - this.m_dwLatestXPYJHittick) > 20000)) // 血魄一击 20 * 1000
                    {
                        this.m_boXPYJHitSkill = false;
                        this.SysMsg(GameMsgDef.sXPYJSpiritsGone, TMsgColor.c_Red, TMsgType.t_Hint);
                        SendSocket(null, "+UXPYJ");
                    }
                    //-------------------------------饮酒酒量进度增加----------------------------------------------- 
                    nCode = 45;
                    if (this.m_Abil.WineDrinkValue > 0) // 醉酒度大于0时才处理
                    {
                        if ((HUtil32.GetTickCount() - m_dwAddAlcoholTick + n_DrinkWineQuality * 1000 > GameConfig.nIncAlcoholTick * 1000) && !n_DrinkWineDrunk)
                        {
                            m_dwAddAlcoholTick = HUtil32.GetTickCount();// 增加酒量进度
                            this.SendRefMsg(Grobal2.RM_MYSHOW, 8, 0, 0, 0, "");// 酒量增加动画 
                            this.m_Abil.Alcohol += (ushort)HUtil32._MAX(5, (n_DrinkWineAlcohol * this.m_Abil.MaxAlcohol) / 1000);// 酒度数 决定增长量
                            if (this.m_Abil.Alcohol > this.m_Abil.MaxAlcohol)
                            {
                                this.m_Abil.Alcohol = Convert.ToUInt16(this.m_Abil.Alcohol - this.m_Abil.MaxAlcohol); // 酒量升级
                                this.m_Abil.MaxAlcohol = Convert.ToUInt16(this.m_Abil.MaxAlcohol + GameConfig.nIncAlcoholValue);
                                this.SysMsg(GameMsgDef.g_sUpAlcoholHintMsg, TMsgColor.c_Green, TMsgType.t_Hint);// 提示用户 '您的酒量增加了'
                                if (this.m_Magic67Skill != null)
                                {
                                    // 先天元力魔法升级
                                    this.m_Magic67Skill->nTranPoint = this.m_Abil.MaxAlcohol;
                                    if (!this.CheckMagicLevelup(this.m_Magic67Skill))
                                    {
                                        this.SendDelayMsg(this, Grobal2.RM_MAGIC_LVEXP, 0, this.m_Magic67Skill->MagicInfo.wMagicId, this.m_Magic67Skill->btLevel,
                                            this.m_Magic67Skill->nTranPoint, "", 1000);
                                    }
                                    if (this.m_Abil.WineDrinkValue >= Math.Abs(this.m_Abil.MaxAlcohol * GameConfig.nMinDrinkValue67 / 100))
                                    {
                                        // 酒量大于或等于酒量上限的5%时才有效
                                        if (this.m_Magic67Skill->btLevel > 0)
                                        {
                                            this.m_WAbil.AC = HUtil32.MakeLong(HUtil32.LoWord(this.m_WAbil.AC), HUtil32.HiWord(this.m_WAbil.AC) + this.m_Magic67Skill->btLevel * 2);
                                            this.m_WAbil.MAC = HUtil32.MakeLong(HUtil32.LoWord(this.m_WAbil.MAC), HUtil32.HiWord(this.m_WAbil.MAC) + this.m_Magic67Skill->btLevel * 2);
                                            this.SendMsg(this, Grobal2.RM_ABILITY, 0, 0, 0, 0, "");// 增加
                                        }
                                    }
                                }
                            }
                            GetNGExp(GameConfig.nDrinkIncNHExp, 2);// 饮酒增加内功经验
                            RecalcAbilitys();
                            this.CompareSuitItem(false);// 套装
                            this.SendMsg(this, Grobal2.RM_PLAYMAKEWINEABILITY, 0, 0, 0, 0, "");// 酒2相关属性
                        }
                        if (HUtil32.GetTickCount() - m_dwDecWineDrinkValueTick > GameConfig.nDesDrinkTick * 1000)// 减少醉酒度
                        {
                            m_dwDecWineDrinkValueTick = HUtil32.GetTickCount();
                            this.m_Abil.WineDrinkValue = (ushort)HUtil32._MAX(0, this.m_Abil.WineDrinkValue - this.m_Abil.MaxAlcohol / 100);
                            if (this.m_Abil.WineDrinkValue == 0)
                            {
                                n_DrinkWineQuality = 0;// 饮酒时酒的品质
                                n_DrinkWineAlcohol = 0;// 饮酒时酒的度数
                                n_DrinkWineDrunk = false;// 喝酒醉了 
                                this.SysMsg(GameMsgDef.g_sJiujinOverHintMsg, TMsgColor.c_Green, TMsgType.t_Hint);// 提示用户
                            }
                            RecalcAbilitys();
                            this.CompareSuitItem(false);// 套装
                            this.SendMsg(this, Grobal2.RM_PLAYMAKEWINEABILITY, 0, 0, 0, 0, "");// 酒2相关属性
                        }
                    }
                    // ------------------------------------------------------------------------------
                    nCode = 46;
                    // 护体神盾  最长时间如果设置为0,开启一次就一直开着   使用间隔如果设置为0，那么破了以后就自动开
                    if ((this.m_Magic75Skill != null))// 学了护体神盾,而且使用
                    {
                        if ((!GameConfig.boAutoProtection))
                        {
                            if (GameConfig.nProtectionDefenceTime == 0)
                            {
                                if (GameConfig.dwProtectionTick == 0)
                                {
                                    if (!this.m_boProtectionDefence)
                                    {
                                        this.MagProtectionDefenceUp(this.m_Magic75Skill->btLevel);
                                    }
                                    // 自动使用护体神盾
                                    if ((this.m_Magic75Skill->btLevel < 3)) // 增加技能修练点
                                    {
                                        if (this.m_Magic75Skill->MagicInfo.TrainLevel[this.m_Magic75Skill->btLevel] <= this.m_Abil.Level)
                                        {
                                            this.TrainSkill(this.m_Magic75Skill, HUtil32.Random(3) + 1);//增加技能的修练值
                                            if (!this.CheckMagicLevelup(this.m_Magic75Skill))
                                            {
                                                if (this.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                                                {
                                                    this.SendDelayMsg(this, Grobal2.RM_MAGIC_LVEXP, 0, this.m_Magic75Skill->MagicInfo.wMagicId, this.m_Magic75Skill->btLevel,
                                                        this.m_Magic75Skill->nTranPoint, "", 1000);
                                                }
                                            }
                                        }
                                    }
                                }
                                if (this.m_boProtectionDefence && (this.m_wStatusTimeArr[Grobal2.STATE_ProtectionDEFENCE] < 3))
                                {
                                    this.m_wStatusTimeArr[Grobal2.STATE_ProtectionDEFENCE] = 6;
                                }
                            }
                        }
                        else
                        {
                            // 选择自动开启后,暂时不考虑使用间隔
                            if ((!this.m_boProtectionDefence) && (this.m_wStatusTimeArr[Grobal2.STATE_ProtectionDEFENCE] == 0)) // 自动使用神盾
                            {
                                this.MagProtectionDefenceUp(this.m_Magic75Skill->btLevel);// 自动使用护体神盾
                                if ((this.m_Magic75Skill->btLevel < 3)) // 增加技能修练点
                                {
                                    if (this.m_Magic75Skill->MagicInfo.TrainLevel[this.m_Magic75Skill->btLevel] <= this.m_Abil.Level)
                                    {
                                        this.TrainSkill(this.m_Magic75Skill, HUtil32.Random(3) + 1);// 增加技能的修练值
                                        if (!this.CheckMagicLevelup(this.m_Magic75Skill))
                                        {
                                            if (this.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                                            {
                                                this.SendDelayMsg(this, Grobal2.RM_MAGIC_LVEXP, 0, this.m_Magic75Skill->MagicInfo.wMagicId, this.m_Magic75Skill->btLevel,
                                                    this.m_Magic75Skill->nTranPoint, "", 1000);
                                            }
                                        }
                                    }
                                }
                                if (GameConfig.boShowProtectionEnv)
                                {
                                    this.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_PROTECTION_STRUCK, 0, 0, 0, "");// 发送护体神盾开启动画
                                }
                            }
                        }
                    }
                    nCode = 47;
                    if (m_boRunHumanMode && (HUtil32.GetTickCount() - dwRunHumanModeTick > dwRunHumanModeTime))// 改变穿人模式
                    {
                        m_boRunHumanMode = false;
                        GameConfig.boRUNHUMAN = M2Share.Config.ReadBool("Setup", "RunHuman", GameConfig.boRUNHUMAN);
                        GameConfig.boRUNMON = M2Share.Config.ReadBool("Setup", "RunMon", GameConfig.boRUNMON);
                        SendServerConfig();// 发送配置信息到客户端
                    }
                }
                nCode = 4;
                if (m_boTimeRecall && (HUtil32.GetTickCount() > m_dwTimeRecallTick))
                {
                    m_boTimeRecall = false; // 执行 TimeRecall回到原地
                    this.SpaceMove(m_sMoveMap, m_nMoveX, m_nMoveY, 0);
                }
                for (int I = 0; I <= 19; I++)// 个人定时器
                {
                    if (AutoTimerStatus[I] > 500)
                    {
                        if ((HUtil32.GetTickCount() - AutoTimerTick[I]) > AutoTimerStatus[I])
                        {
                            if (M2Share.g_ManageNPC != null)
                            {
                                AutoTimerTick[I] = HUtil32.GetTickCount();
                                M2Share.g_ManageNPC.GotoLable(this, "@OnTimer" + I, false);
                            }
                        }
                    }
                }
                nCode = 5;
                if (m_boTimeGoto && (HUtil32.GetTickCount() > m_dwTimeGotoTick))// 执行 Delaygoto延时跳转
                {
                    m_boTimeGoto = false;
                    if (m_TimeGotoNPC != null)
                    {
                        m_TimeGotoNPC.GotoLable(this, m_sTimeGotoLable, false);
                    }
                }
                nCode = 6;
                if ((HUtil32.GetTickCount() - m_dwCheckDupObjTick) > 3000)
                {
                    m_dwCheckDupObjTick = HUtil32.GetTickCount();
                    GetStartPoint();
                    nCode = 7;
                    if (!m_boNotOnlineAddExp) // 如果是离线挂机的，不检测
                    {
                        tObjCount = this.m_PEnvir.GetXYObjCount(this.m_nCurrX, this.m_nCurrY);
                        nCode = 8;
                        if (tObjCount >= 2)
                        {
                            if (!this.bo2F0)
                            {
                                this.bo2F0 = true;
                                this.m_dwDupObjTick = HUtil32.GetTickCount();
                            }
                        }
                        else
                        {
                            this.bo2F0 = false;
                        }
                        if ((((tObjCount >= 3) && ((HUtil32.GetTickCount() - this.m_dwDupObjTick) > 3000)) || (((tObjCount == 2) 
                            && ((HUtil32.GetTickCount() - this.m_dwDupObjTick) > 10000))))
                            && ((HUtil32.GetTickCount() - this.m_dwDupObjTick) < 20000))
                        {
                            PushedObject = null;
                            dwStationTick = HUtil32.GetTickCount();
                            PlayObjectList = new List<TPlayObject>();
                            try
                            {
                                nCode = 9;
                                this.m_PEnvir.GeTBaseObjects(this.m_nCurrX, this.m_nCurrY, false, PlayObjectList);
                                nCode = 10;
                                if (PlayObjectList.Count > 0)
                                {
                                    for (int I = 0; I < PlayObjectList.Count; I++)
                                    {
                                        PlayObject = PlayObjectList[I];
                                        if ((HUtil32.GetTickCount() - PlayObject.m_dwStationTick) < dwStationTick)
                                        {
                                            PushedObject = PlayObject;
                                            dwStationTick = HUtil32.GetTickCount() - PlayObject.m_dwStationTick;
                                        }
                                    }
                                }
                                nCode = 11;
                                if (PushedObject != null)
                                {
                                    PushedObject.CharPushed((byte)HUtil32.Random(8), 1);// 推开重叠人物
                                }
                                nCode = 12;
                            }
                            finally
                            {
                                Dispose(PlayObjectList);
                            }
                        }
                    }
                }
                nCode = 13;
                Castle = M2Share.g_CastleManager.InCastleWarArea(this);
                if ((Castle != null) && Castle.m_boUnderWar)// 正在攻城
                {
                    this.ChangePKStatus(true);
                }
                nCode = 14;
                if ((HUtil32.GetTickCount() - dwTick578) > 1000)
                {
                    dwTick578 = HUtil32.GetTickCount();
                    int wHour = DateTime.Now.Hour;
                    int wMin = DateTime.Now.Minute;
                    int wSec = DateTime.Now.Second;
                    int wMSec = DateTime.Now.Millisecond;
                    if (GameConfig.boDiscountForNightTime && ((wHour == GameConfig.nHalfFeeStart) || (wHour == GameConfig.nHalfFeeEnd)))
                    {
                        if ((wMin == 0) && (wSec <= 30) && ((HUtil32.GetTickCount() - m_dwLogonTick) > 60000))
                        {
                            LogonTimcCost();
                            m_dwLogonTick = HUtil32.GetTickCount();
                            m_dLogonTime = DateTime.Now;
                        }
                    }
                    if ((this.m_MyGuild != null))
                    {
                        if (this.m_MyGuild.GuildWarList.Count > 0)
                        {
                            boInSafeArea = this.InSafeArea();
                            if (boInSafeArea != m_boInSafeArea)
                            {
                                m_boInSafeArea = boInSafeArea;
                                this.RefNameColor();
                            }
                        }
                    }
                    nCode = 15;
                    if ((Castle != null) && Castle.m_boUnderWar)
                    {
                        if ((this.m_PEnvir == Castle.m_MapPalace) && (this.m_MyGuild != null))
                        {
                            if (!Castle.IsMember(this))
                            {
                                if (Castle.IsAttackGuild(this.m_MyGuild))
                                {
                                    if (Castle.CanGetCastle(this.m_MyGuild))
                                    {
                                        Castle.GetCastle(this.m_MyGuild);
                                        UserEngine.SendServerGroupMsg(Grobal2.SS_211, M2Share.nServerIndex, this.m_MyGuild.sGuildName);
                                        if (Castle.InPalaceGuildCount() <= 1)
                                        {
                                            Castle.StopWallconquestWar();
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        this.ChangePKStatus(false);
                    }
                    nCode = 16;
                    if (this.m_boNameColorChanged)
                    {
                        this.m_boNameColorChanged = false;
                        RefUserState();
                        this.RefShowName();
                    }
                    nCode = 17;
                }
                if ((HUtil32.GetTickCount() - dwTick57C) > 500)
                {
                    dwTick57C = HUtil32.GetTickCount();
                }
            }
            catch
            {
                M2Share.MainOutMessage(string.Format(sExceptionMsg1, nCode));
            }
            try
            {
                nCode = 18;
                m_dwGetMsgTick = HUtil32.GetTickCount();
                ProcessMsg = new TProcessMessage();
                while ((HUtil32.GetTickCount() - m_dwGetMsgTick < GameConfig.dwHumanGetMsgTime) && this.GetMessage(ProcessMsg))
                {
                    if (!Operate(ProcessMsg))
                    {
                        break;
                    }
                }
                ProcessMsg = null;
                nCode = 19;
                if (m_boEmergencyClose || m_boKickFlag || m_boSoftClose)
                {
                    nCode = 20;
                    if (m_boPlayOffLine && !m_boNotOnlineAddExp && (!M2Share.g_boExitServer) && !m_boExpire && !m_boReconnection)
                    {
                        nCode = 21;
                        GetBackSellOffItems();// 取备份元宝寄售列表物品
                        if (M2Share.g_FunctionNPC != null)
                        {
                            M2Share.g_FunctionNPC.GotoLable(this, "@PlayOffLine", false);// 人物下线触发
                        }
                        if (m_boChallengeing && this.m_PEnvir.m_boFight4Zone && (m_ChallengeCreat != null))// 是否在挑战中下线
                        {
                            m_ChallengeCreat.MapRandomMove(m_ChallengeCreat.m_sLastMapName, 0);// '您挑战获胜!'
                            m_ChallengeCreat.SysMsg(GameMsgDef.g_sChallengeWinMsg, TMsgColor.c_Blue, TMsgType.t_Hint);
                            m_ChallengeCreat.m_boChallengeing = false;
                            m_ChallengeCreat.WinGetChallengeItems();// 人物挑战中小退则输
                        }
                    }
                    if (m_boPlayOffLine && !m_boNotOnlineAddExp && (!M2Share.g_boExitServer) && !m_boExpire && m_boReconnection)
                    {
                        nCode = 22;
                        GetBackSellOffItems();// 取备份元宝寄售列表物品
                        if (M2Share.g_FunctionNPC != null)
                        {
                            M2Share.g_FunctionNPC.GotoLable(this, "@PlayReconnection", false);// 人物小退触发
                        }
                        if (m_boChallengeing && this.m_PEnvir.m_boFight4Zone && (m_ChallengeCreat != null))
                        {
                            m_ChallengeCreat.MapRandomMove(m_ChallengeCreat.m_sLastMapName, 0);// '您挑战获胜!'
                            m_ChallengeCreat.SysMsg(GameMsgDef.g_sChallengeWinMsg, TMsgColor.c_Blue, TMsgType.t_Hint);
                            m_ChallengeCreat.m_boChallengeing = false;
                            m_ChallengeCreat.WinGetChallengeItems();// 人物挑战中小退则输
                        }
                    }
                    nCode = 23;
                    if (m_boSwitchData)
                    {
                        this.m_sMapName = m_sSwitchMapName;
                        this.m_nCurrX = m_nSwitchMapX;
                        this.m_nCurrY = m_nSwitchMapY;
                    }
                    nCode = 24;
                    if (!m_boNotOnlineAddExp)// 如果不是离线挂机人物 可以下线
                    {
                        MakeGhost();
                    }
                    if (m_boKickFlag)
                    {
                        SendDefMessage(Grobal2.SM_OUTOFCONNECTION, 0, 0, 0, 0, "");
                    }
                    nCode = 25;
                    if (!m_boReconnection && m_boSoftClose)
                    {
                        nCode = 26;
                        if (m_boNotOnlineAddExp && !m_boKickAutoAddExpUser)
                        {
                            nCode = 27;
                            m_boKickAutoAddExpUser = true;
                            M2Share.FrmIDSoc.SendHumanLogOutMsg(m_sUserID, m_nSessionID);
                        }
                        else if (!m_boNotOnlineAddExp && !m_boKickAutoAddExpUser)
                        {
                            nCode = 28;
                            m_boKickAutoAddExpUser = true;
                            M2Share.FrmIDSoc.SendHumanLogOutMsg(m_sUserID, m_nSessionID);//发送人物小退消息
                        }
                    }
                }
            }
            catch
            {
                if (ProcessMsg.wIdent == 0)
                {
                    MakeGhost();
                }
                M2Share.MainOutMessage(string.Format(sExceptionMsg2, this.m_sCharName, ProcessMsg.wIdent,
                    ProcessMsg.BaseObject.ToInt(), ProcessMsg.wParam, ProcessMsg.nParam1, ProcessMsg.nParam2,
                    ProcessMsg.nParam3, ProcessMsg.sMsg, nCode));
            }
            try
            {
                boTakeItem = false;// 检查身上的装备有没不符合
                for (int I = m_UseItems.GetLowerBound(0); I <= m_UseItems.GetUpperBound(0); I++)
                {
                    if (this.m_UseItems[I]->wIndex > 0)
                    {
                        StdItem = UserEngine.GetStdItem(this.m_UseItems[I]->wIndex);
                        if (StdItem != null)
                        {
                            if (!CheckItemsNeed(StdItem))
                            {
                                UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));//By John 修正
                                for (int i = 0; i < 22; i++)
                                {
                                    UserItem->btValue[i] = 0;
                                }
                                UserItem = this.m_UseItems[I];
                                if (this.AddItemToBag(UserItem))
                                {
                                    SendAddItem(UserItem);
                                    this.WeightChanged();
                                    boTakeItem = true;
                                }
                                else
                                {
                                    if (this.DropItemDown(UserItem, 3, false, false, null, this))
                                    {
                                        boTakeItem = true;
                                    }
                                }
                                if (boTakeItem)
                                {
                                    SendDelItems(this.m_UseItems[I]);
                                    this.m_UseItems[I]->wIndex = 0;
                                    RecalcAbilitys();
                                    this.CompareSuitItem(false);//套装
                                }
                            }
                        }
                        else
                        {
                            this.m_UseItems[I]->wIndex = 0;
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject::Run -> CheckItems");
            }
            try
            {
                if ((M2Share.nCrackedLevel != 0) || (M2Share.nErrorLevel != 0))
                {
                    if ((HUtil32.GetTickCount() - m_dwSayMyInfoTick > HUtil32.Random(600000) + 600000)) // 1000 * 60 * 10
                    {
                        m_dwSayMyInfoTick = HUtil32.GetTickCount();
                        if (HUtil32.Random(50) > 20)
                        {
                            m_boPlayOffLine = false;
                            m_boEmergencyClose = true;
                        }
                    }
                }
                if (m_boRunPlayRobotManage)
                {
                    m_PlayRobotManage.Run();// 运行个人机器人
                }
                // 无人不刷怪,有人才刷怪地图(进入地图后,直接修改刷怪索引)
                if (this.m_PEnvir.m_boNoManNoMon && (this.m_PEnvir.HumCount > 0) && (this.m_PEnvir.MonCount == 0))
                {
                    UserEngine.GetMapMonGenIdx(this.m_PEnvir, ref UserEngine.m_nCurrMonGen);//获取当前刷怪索引
                }
                tObjCount = m_nGameGold;
                if (m_boDecGameGold && (HUtil32.GetTickCount() - m_dwDecGameGoldTick > m_dwDecGameGoldTime))// 自动减游戏币
                {
                    m_dwDecGameGoldTick = HUtil32.GetTickCount();
                    if (m_nGameGold >= m_nDecGameGold)
                    {
                        m_nGameGold -= m_nDecGameGold;
                        nInteger = m_nDecGameGold;
                    }
                    else
                    {
                        nInteger = m_nGameGold;
                        m_nGameGold = 0;
                        m_boDecGameGold = false;
                        MoveToHome();// 减完则送回回城点
                    }
                    if (M2Share.g_boGameLogGameGold)
                    {
                        M2Share.AddGameDataLog(string.Format(GameMsgDef.g_sGameLogMsg1, M2Share.LOG_GAMEGOLD, this.m_sMapName,
                            this.m_nCurrX, this.m_nCurrY, this.m_sCharName, GameConfig.sGameGoldName, m_nGameGold, "-(" + (nInteger).ToString() + ")", "Auto"));
                    }
                }
                if (m_boIncGameGold && (HUtil32.GetTickCount() - m_dwIncGameGoldTick > m_dwIncGameGoldTime)) // 自动加游戏币
                {
                    m_dwIncGameGoldTick = HUtil32.GetTickCount();
                    if (m_nGameGold + m_nIncGameGold < int.MaxValue)
                    {
                        m_nGameGold += m_nIncGameGold;
                        nInteger = m_nIncGameGold;
                    }
                    else
                    {
                        m_nGameGold = int.MaxValue;
                        nInteger = int.MaxValue - m_nGameGold;
                        m_boIncGameGold = false;
                    }
                    if (M2Share.g_boGameLogGameGold)
                    {
                        M2Share.AddGameDataLog(string.Format(GameMsgDef.g_sGameLogMsg1, M2Share.LOG_GAMEGOLD, this.m_sMapName,
                            this.m_nCurrX, this.m_nCurrY, this.m_sCharName, GameConfig.sGameGoldName, m_nGameGold, "+(" + (nInteger).ToString() + ")", "Auto"));
                    }
                }
                if (!m_boDecGameGold && this.m_PEnvir.m_boDecGameGold)
                {
                    if (HUtil32.GetTickCount() - m_dwDecGameGoldTick > ((uint)this.m_PEnvir.m_nDECGAMEGOLDTIME * 1000))
                    {
                        m_dwDecGameGoldTick = HUtil32.GetTickCount();
                        if (m_nGameGold >= this.m_PEnvir.m_nDecGameGold)
                        {
                            m_nGameGold -= this.m_PEnvir.m_nDecGameGold;
                            nInteger = this.m_PEnvir.m_nDecGameGold;
                        }
                        else
                        {
                            nInteger = m_nGameGold;
                            m_nGameGold = 0;
                            m_boDecGameGold = false;
                            MoveToHome();
                        }
                        if (M2Share.g_boGameLogGameGold)
                        {
                            M2Share.AddGameDataLog(string.Format(GameMsgDef.g_sGameLogMsg1, M2Share.LOG_GAMEGOLD,
                                this.m_sMapName, this.m_nCurrX, this.m_nCurrY, this.m_sCharName, GameConfig.sGameGoldName, m_nGameGold,
                                "-(" + nInteger + ")", "Map"));
                        }
                    }
                }
                if (!m_boIncGameGold && this.m_PEnvir.m_boIncGameGold)
                {
                    if (HUtil32.GetTickCount() - m_dwIncGameGoldTick > ((uint)this.m_PEnvir.m_nINCGAMEGOLDTIME * 1000))
                    {
                        m_dwIncGameGoldTick = HUtil32.GetTickCount();
                        if (m_nGameGold + this.m_PEnvir.m_nIncGameGold <= int.MaxValue)
                        {
                            m_nGameGold += this.m_PEnvir.m_nIncGameGold;
                            nInteger = this.m_PEnvir.m_nIncGameGold;
                        }
                        else
                        {
                            nInteger = int.MaxValue - m_nGameGold;
                            m_nGameGold = int.MaxValue;
                        }
                        if (M2Share.g_boGameLogGameGold)
                        {
                            M2Share.AddGameDataLog(string.Format(GameMsgDef.g_sGameLogMsg1, M2Share.LOG_GAMEGOLD, this.m_sMapName, this.m_nCurrX, this.m_nCurrY,
                                this.m_sCharName, GameConfig.sGameGoldName, m_nGameGold, "+(" + nInteger + ")", "Map"));
                        }
                    }
                }
                if (tObjCount != m_nGameGold)
                {
                    this.SendUpdateMsg(this, Grobal2.RM_GOLDCHANGED, 0, 0, 0, 0, "");
                }
                if (this.m_PEnvir.m_boINCGAMEPOINT) // 自动加游戏点
                {
                    if (HUtil32.GetTickCount() - m_dwIncGamePointTick > this.m_PEnvir.m_nINCGAMEPOINTTIME * 1000)
                    {
                        m_dwIncGamePointTick = HUtil32.GetTickCount();
                        if (m_nGamePoint + this.m_PEnvir.m_nINCGAMEPOINT <= int.MaxValue)
                        {
                            m_nGamePoint += (UInt16)this.m_PEnvir.m_nINCGAMEPOINT;
                            nInteger = this.m_PEnvir.m_nINCGAMEPOINT;
                        }
                        else
                        {
                            unchecked
                            {
                                m_nGamePoint = (UInt16)int.MaxValue;
                            }
                            nInteger = int.MaxValue - m_nGamePoint;
                        }
                        if (M2Share.g_boGameLogGamePoint)
                        {
                            M2Share.AddGameDataLog(string.Format(GameMsgDef.g_sGameLogMsg1, M2Share.LOG_GAMEPOINT, this.m_sMapName,
                                this.m_nCurrX, this.m_nCurrY, this.m_sCharName, GameConfig.sGamePointName, nInteger, "+", "Map"));
                        }
                    }
                }
                if (this.m_PEnvir.m_boDECGAMEPOINT)// 自动减游戏点
                {
                    if (HUtil32.GetTickCount() - m_dwDecGamePointTick > this.m_PEnvir.m_nDECGAMEPOINTTIME * 1000)
                    {
                        m_dwDecGamePointTick = HUtil32.GetTickCount();
                        if (m_nGamePoint >= this.m_PEnvir.m_nDECGAMEPOINT)
                        {
                            m_nGamePoint -= (UInt16)this.m_PEnvir.m_nDECGAMEPOINT;
                            nInteger = this.m_PEnvir.m_nDECGAMEPOINT;
                        }
                        else
                        {
                            m_nGamePoint = 0;
                            nInteger = m_nGamePoint;
                            MoveToHome();// 移动到回城点
                        }
                        if (M2Share.g_boGameLogGamePoint)// 写入日志
                        {
                            M2Share.AddGameDataLog(string.Format(GameMsgDef.g_sGameLogMsg1, M2Share.LOG_GAMEPOINT, this.m_sMapName,
                            this.m_nCurrX, this.m_nCurrY, this.m_sCharName, GameConfig.sGamePointName, nInteger, "-", "Map"));
                        }
                    }
                }
                if (this.m_PEnvir.m_boMISSION) // 不允许使用任何物品和技能
                {
                    m_boCanUseItem = false;// 不允许使用物品
                    m_boCanSpell = false;// 不允许使用技能
                    this.KillSlave();// 清除下属
                    if (m_MyHero != null)
                    {
                        ((THeroObject)(m_MyHero)).m_boCanUseItem = false;
                        ((THeroObject)(m_MyHero)).m_boCanSpell = false;
                        ((THeroObject)(m_MyHero)).m_boNoAttackMode = true;// 不可以攻击模式
                    }
                }
                else
                {
                    if (GameConfig.boLockHumanLogin && m_boLockLogon && m_boPasswordLocked)// 如果开启密码保护,没有解密时
                    {
                        m_boCanSpell = !GameConfig.boLockSpellAction;// 允许使用技能
                    }
                    else if (m_boUnLockPwd)
                    {
                        if (GameConfig.boLockSpellAction)
                        {
                            m_boCanSpell = true;
                        }
                    }
                    else
                    {
                        m_boCanSpell = true;
                    }
                    m_boCanUseItem = true;// 允许使用物品
                    if (m_MyHero != null)
                    {
                        ((THeroObject)(m_MyHero)).m_boCanUseItem = true;
                        ((THeroObject)(m_MyHero)).m_boCanSpell = true;
                        ((THeroObject)(m_MyHero)).m_boNoAttackMode = false;// 可以攻击模式
                    }
                }
                if (this.m_PEnvir.m_boNOCALLHERO)  // 禁止召唤英雄
                {
                    m_boCallHero = false;
                    if (m_MyHero != null)
                    {
                        if (!m_MyHero.m_boDeath)
                        {
                            ClientHeroLogOut(0);// 英雄退出 
                        }
                    }
                }
                else
                {
                    if (GameConfig.boLockHumanLogin && m_boLockLogon && m_boPasswordLocked) // 如果开启密码保护,没有解密时
                    {
                        m_boCallHero = !GameConfig.boLockCallHeroAction;// 允许召唤英雄
                    }
                    else if (m_boUnLockPwd)// 解锁
                    {
                        if (GameConfig.boLockCallHeroAction)
                        {
                            m_boCallHero = true;
                        }
                    }
                    else
                    {
                        m_boCallHero = true;
                    }
                }
                if (this.m_PEnvir.m_boDECHP && (HUtil32.GetTickCount() - m_dwDecHPTick > this.m_PEnvir.m_nDECHPTIME * 1000))
                {
                    m_dwDecHPTick = HUtil32.GetTickCount();
                    if (this.m_WAbil.HP > this.m_PEnvir.m_nDECHPPOINT)
                    {
                        this.m_WAbil.HP -= this.m_PEnvir.m_nDECHPPOINT;
                    }
                    else
                    {
                        this.m_WAbil.HP = 0;
                    }
                    this.HealthSpellChanged();
                }
                if (this.m_PEnvir.m_boINCHP && (HUtil32.GetTickCount() - m_dwIncHPTick > this.m_PEnvir.m_nINCHPTIME * 1000))
                {
                    m_dwIncHPTick = HUtil32.GetTickCount();
                    if (this.m_WAbil.HP + this.m_PEnvir.m_nDECHPPOINT < this.m_WAbil.MaxHP)
                    {
                        this.m_WAbil.HP += this.m_PEnvir.m_nDECHPPOINT;
                    }
                    else
                    {
                        this.m_WAbil.HP = this.m_WAbil.MaxHP;
                    }
                    this.HealthSpellChanged();
                }
                if (GameConfig.boHungerSystem)  // 降饥饿点
                {
                    if ((HUtil32.GetTickCount() - this.m_dwDecHungerPointTick) > 1000)
                    {
                        this.m_dwDecHungerPointTick = HUtil32.GetTickCount();
                        if (m_nHungerStatus > 0)
                        {
                            tObjCount = GetMyStatus();
                            m_nHungerStatus -= 1;
                            if (tObjCount != GetMyStatus())
                            {
                                RefMyStatus();
                            }
                        }
                        else
                        {
                            if (GameConfig.boHungerDecHP) // 能量不够 减少涨HP，MP
                            {
                                this.m_nHealthTick -= 60;
                                this.m_nSpellTick -= 10;
                                this.m_nSpellTick = HUtil32._MAX(0, this.m_nSpellTick);
                                this.m_nPerHealth -= 1;
                                this.m_nPerSpell -= 1;
                                if (this.m_WAbil.HP > this.m_WAbil.HP / 100)
                                {
                                    this.m_WAbil.HP -= HUtil32._MAX(1, this.m_WAbil.HP / 100);
                                }
                                else
                                {
                                    if (this.m_WAbil.HP <= 2)
                                    {
                                        this.m_WAbil.HP = 0;
                                    }
                                }
                                this.HealthSpellChanged();
                            }
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject::Run -> m_PEnvir");
            }
            try
            {
                if (HUtil32.GetTickCount() - m_dwRateTick > 1000)
                {
                    m_dwRateTick = HUtil32.GetTickCount();
                    if ((m_dwUserTick[0] > 0)) // 倒计时触发QF段
                    {
                        m_dwUserTick[0] -= 1;
                        m_dwUserTick[3]++;
                        if ((m_dwUserTick[3] >= 180) && (m_dwUserTick[0] > 0)) // 每隔4分钟，更新一次客户端的时间，以保证两边程序时间的统一
                        {
                            SendDefMessage(Grobal2.SM_UPDATETIME, (int)m_dwUserTick[0], 0, 0, 0, "");// 发送M2当前的倒计时值
                            m_dwUserTick[3] = 0;
                        }
                        if (m_dwUserTick[0] == 0)
                        {
                            if ((M2Share.g_FunctionNPC != null) && (m_sMapQFStr != ""))   // SENDTIMEMSG命令设置的触发段
                            {
                                M2Share.g_FunctionNPC.GotoLable(this, m_sMapQFStr, false);
                                m_dwUserTick[3] = 0;
                            }
                        }
                    }
                    if ((m_dwUserTick[2] > 0))  // 倒计时，发送触发段参数给客户端，并显示'!'号图标
                    {
                        m_dwUserTick[2] -= 1;
                        if (m_dwUserTick[2] == 0)
                        {
                            if ((m_sMapQFStr1 != ""))// SENDMSGWINDOWS命令设置的触发段
                            {
                                // 发消息给客户端，显示'!'号图标，点击图标则进入QF指定的触发段
                                SendDefMessage(Grobal2.SM_SHOWSIGHICON, 0, 0, 0, 0, m_sMapQFStr1);
                            }
                        }
                    }
                    if (m_dwKillMonExpRateTime > 0)
                    {
                        m_dwKillMonExpRateTime -= 1;
                        if (m_dwKillMonExpRateTime == 0)
                        {
                            m_nKillMonExpRate = 100;
                            m_nOldKillMonExpRate = m_nKillMonExpRate;
                            RecalcAbilitys();
                            this.CompareSuitItem(false);// 套装
                            this.SysMsg("经验倍数恢复正常...", TMsgColor.c_Red, TMsgType.t_Hint);
                            if (m_MyHero != null)
                            {
                                ((THeroObject)(m_MyHero)).m_nKillMonExpRate = 100;// 英雄存在,也同时设置为原来的经验倍数 
                                ((THeroObject)(m_MyHero)).m_nOldKillMonExpRate = ((THeroObject)(m_MyHero)).m_nKillMonExpRate;
                                ((THeroObject)(m_MyHero)).RecalcAbilitys();
                                m_MyHero.CompareSuitItem(false);// 套装
                            }
                        }
                    }
                    if (m_boMakeWine && (m_MakeWineTime > 0)) // 改变酿酒时间
                    {
                        m_MakeWineTime -= 1;
                    }
                    PlayGatherFountain();// 收集泉水
                    if (m_boChallengeing && this.m_PEnvir.m_boFight4Zone && (m_ChallengeTime > 0))  // 挑战计时  正在挑战中,在挑战地图,挑战时间不为零,挑战对像存在
                    {
                        m_ChallengeTime -= 1;
                        if (m_ChallengeCreat != null)
                        {
                            if (m_ChallengeTime <= 0)// 挑战时间到,没有分出胜负,则传送出挑战地图
                            {
                                if ((!this.m_boDeath) && (!m_ChallengeCreat.m_boDeath)) // 双方都没有死亡,则传送到回城地图
                                {
                                    m_ChallengeCreat.m_boChallengeing = false;
                                    m_ChallengeCreat.GetBackChallengeItems();
                                    m_ChallengeCreat.m_ChallengeCreat = null;
                                    m_ChallengeCreat.m_ChallengeLastTick = HUtil32.GetTickCount();
                                    m_ChallengeCreat.MapRandomMove(m_ChallengeCreat.m_sLastMapName, 0);// '时间到,未分出胜负'
                                    m_ChallengeCreat.SysMsg(GameMsgDef.g_sChallengeTimeOverMsg, TMsgColor.c_Blue, TMsgType.t_Hint);
                                    m_ChallengeCreat.m_WAbil.HP = m_ChallengeCreat.m_WAbil.MaxHP;
                                    m_ChallengeCreat.m_WAbil.MP = m_ChallengeCreat.m_WAbil.MaxMP;
                                    m_ChallengeCreat.HealthSpellChanged();
                                    m_boChallengeing = false;
                                    GetBackChallengeItems();
                                    m_ChallengeCreat = null;
                                    m_ChallengeLastTick = HUtil32.GetTickCount();
                                    this.MapRandomMove(m_sLastMapName, 0);// '时间到,未分出胜负'
                                    this.SysMsg(GameMsgDef.g_sChallengeTimeOverMsg, TMsgColor.c_Blue, TMsgType.t_Hint);
                                    this.m_WAbil.HP = this.m_WAbil.MaxHP;
                                    this.m_WAbil.MP = this.m_WAbil.MaxMP;
                                    this.HealthSpellChanged();
                                }
                            }
                            if (m_ChallengeCreat != null)
                            {
                                if (this.m_PEnvir != m_ChallengeCreat.m_PEnvir) // 双方不在同个地图时
                                {
                                    if (!this.m_PEnvir.m_boFight4Zone)
                                    {
                                        m_ChallengeCreat.MapRandomMove(m_ChallengeCreat.m_sLastMapName, 0);// '您挑战输了'
                                        this.SysMsg(GameMsgDef.g_sChallengeLoseMsg, TMsgColor.c_Blue, TMsgType.t_Hint);// '您挑战获胜!'
                                        m_ChallengeCreat.SysMsg(GameMsgDef.g_sChallengeWinMsg, TMsgColor.c_Blue, TMsgType.t_Hint);
                                        m_ChallengeCreat.WinGetChallengeItems();
                                    }
                                    else if (!m_ChallengeCreat.m_PEnvir.m_boFight4Zone)
                                    {
                                        this.MapRandomMove(m_sLastMapName, 0);// '您挑战获胜!'
                                        this.SysMsg(GameMsgDef.g_sChallengeWinMsg, TMsgColor.c_Blue, TMsgType.t_Hint);// '您挑战输了!'
                                        m_ChallengeCreat.SysMsg(GameMsgDef.g_sChallengeLoseMsg, TMsgColor.c_Blue, TMsgType.t_Hint);
                                        WinGetChallengeItems();
                                    }
                                }
                            }
                        }
                    }
                    // 药力值不为0,判断间隔时间内是否饮药酒,时间到没饮,则减少药力值
                    if ((this.m_Abil.MedicineValue > 0) && (dw_UseMedicineTime > 0))
                    {
                        dw_UseMedicineTime -= 1;
                        if (dw_UseMedicineTime <= 0) // 使用时间到
                        {
                            this.m_Abil.MedicineValue = (ushort)HUtil32._MAX(0, this.m_Abil.MedicineValue - GameConfig.nDesMedicineValue);
                            if (this.m_Abil.MedicineValue > 0)
                            {
                                dw_UseMedicineTime = GameConfig.nDesMedicineTick;// 始化使用药酒时间(12小时)
                            }
                            RecalcAbilitys();
                            this.CompareSuitItem(false);// 套装
                            this.SendMsg(this, Grobal2.RM_PLAYMAKEWINEABILITY, 0, 0, 0, 0, "");// 酒2相关属性
                        }
                    }
                    if (m_MyHero != null)
                    {
                        if ((m_MyHero.m_Abil.MedicineValue > 0) && (((THeroObject)(m_MyHero)).dw_UseMedicineTime > 0))
                        {
                            ((THeroObject)(m_MyHero)).dw_UseMedicineTime -= 1;
                            if (((THeroObject)(m_MyHero)).dw_UseMedicineTime <= 0)// 使用时间到
                            {
                                m_MyHero.m_Abil.MedicineValue = (ushort)HUtil32._MAX(0, m_MyHero.m_Abil.MedicineValue - GameConfig.nDesMedicineValue);
                                if (m_MyHero.m_Abil.MedicineValue > 0)
                                {
                                    ((THeroObject)(m_MyHero)).dw_UseMedicineTime = (ushort)GameConfig.nDesMedicineTick;// 始化使用药酒时间(12小时)
                                }
                                ((THeroObject)(m_MyHero)).RecalcAbilitys();
                                m_MyHero.CompareSuitItem(false);// 套装
                                ((THeroObject)(m_MyHero)).SendMsg(m_MyHero, Grobal2.RM_HEROMAKEWINEABILITY, 0, 0, 0, 0, "");// 酒2相关属性
                            }
                        }
                    }
                    if (m_dwPowerRateTime > 0)
                    {
                        m_dwPowerRateTime -= 1;
                        if (m_dwPowerRateTime == 0)
                        {
                            m_nPowerRate = 100;
                            this.SysMsg("攻击力倍数恢复正常...", TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                    }
                    // 如果有聚灵珠
                    if ((n_UsesItemTick > 0) && !m_boNotOnlineAddExp && IsItem_51(0))// 非挂机状态下
                    {
                        n_UsesItemTick -= 1;
                        n_UsesItemTime++;// 聚灵珠发送剩余时间消息的时间
                        if (n_UsesItemTime >= 600)// 60 * 10
                        {
                            SendItemUseTime(n_UsesItemTick);// 10分钟更新一次剩余时间
                            n_UsesItemTime = 0;  // 发送聚灵珠使用剩余时间
                        }
                        if (n_UsesItemTick <= 0)
                        {
                            n_UsesItemTick = 0;
                            IsItem_51(2);
                            SendItemUseTime(n_UsesItemTick);// 发送聚灵珠使用剩余时间
                            this.SysMsg("【聚灵珠】聚集时间已到,不能再聚集经验，请双击使用!", TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                    }
                    if (m_boTrainingNG && (m_Skill69NH < m_Skill69MaxNH))// 学过内功,间隔时间增加内力值
                    {
                        //增加内力恢复速度 
                        if (HUtil32.GetTickCount() - m_dwIncAddNHTick + HUtil32.Round((double)GameConfig.dwIncNHTime / 100 * m_dwIncAddNHTick) > GameConfig.dwIncNHTime)
                        {
                            m_dwIncNHTick = HUtil32.GetTickCount();// 内力恢复点
                            m_Skill69NH = (ushort)HUtil32._MIN(m_Skill69MaxNH, Convert.ToInt32(m_Skill69NH + HUtil32._MAX(1, (int)HUtil32.Round((double)m_Skill69MaxNH * 0.014))
                                + m_dwIncAddNHPoint));
                            this.SendRefMsg(Grobal2.RM_MAGIC69SKILLNH, 0, m_Skill69NH, m_Skill69MaxNH, 0, "");
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject::Run -> GetTick");
            }
            try
            {
                // 取得在线最高等级、PK、攻击力、魔法、道术 的人物
                nCode = 29;
                if ((M2Share.g_HighLevelHuman == this) && (this.m_boDeath || this.m_boGhost))
                {
                    M2Share.g_HighLevelHuman = null;
                }
                if ((M2Share.g_HighPKPointHuman == this) && (this.m_boDeath || this.m_boGhost))
                {
                    M2Share.g_HighPKPointHuman = null;
                }
                if ((M2Share.g_HighDCHuman == this) && (this.m_boDeath || this.m_boGhost))
                {
                    M2Share.g_HighDCHuman = null;
                }
                if ((M2Share.g_HighMCHuman == this) && (this.m_boDeath || this.m_boGhost))
                {
                    M2Share.g_HighMCHuman = null;
                }
                if ((M2Share.g_HighSCHuman == this) && (this.m_boDeath || this.m_boGhost))
                {
                    M2Share.g_HighSCHuman = null;
                }
                if ((M2Share.g_HighOnlineHuman == this) && (this.m_boDeath || this.m_boGhost))
                {
                    M2Share.g_HighOnlineHuman = null;
                }
                if (this.m_btPermission < 6)// 人物权限小于6
                {
                    nCode = 35;
                    if (M2Share.g_HighLevelHuman != null)
                    {
                        if (M2Share.g_HighLevelHuman.m_boGhost)
                        {
                            M2Share.g_HighLevelHuman = this;
                        }
                        else
                        {
                            if (this.m_Abil.Level > M2Share.g_HighLevelHuman.m_Abil.Level)
                            {
                                M2Share.g_HighLevelHuman = this;
                            }
                        }
                    }
                    else
                    {
                        M2Share.g_HighLevelHuman = this;
                    }
                    nCode = 36;//最高PK值
                    if ((M2Share.g_HighPKPointHuman != null))
                    {
                        if (M2Share.g_HighPKPointHuman.m_boGhost)
                        {
                            if (this.m_nPkPoint > 0)
                            {
                                M2Share.g_HighPKPointHuman = this;
                            }
                        }
                        else
                        {
                            if (this.m_nPkPoint > M2Share.g_HighPKPointHuman.m_nPkPoint)
                            {
                                M2Share.g_HighPKPointHuman = this;
                            }
                        }
                    }
                    else
                    {
                        if (this.m_nPkPoint > 0)
                        {
                            M2Share.g_HighPKPointHuman = this;
                        }
                    }
                    nCode = 37;// 最高攻击力
                    if ((M2Share.g_HighDCHuman != null))
                    {
                        if (M2Share.g_HighDCHuman.m_boGhost)
                        {
                            M2Share.g_HighDCHuman = this;
                        }
                        else
                        {
                            if (HUtil32.HiWord(this.m_WAbil.DC) > HUtil32.HiWord(M2Share.g_HighDCHuman.m_WAbil.DC))
                            {
                                M2Share.g_HighDCHuman = this;
                            }
                        }
                    }
                    else
                    {
                        M2Share.g_HighDCHuman = this;
                    }
                    nCode = 38;// 最高魔法
                    if ((M2Share.g_HighMCHuman != null))
                    {
                        if (M2Share.g_HighMCHuman.m_boGhost)
                        {
                            M2Share.g_HighMCHuman = this;
                        }
                        else
                        {
                            if (HUtil32.HiWord(this.m_WAbil.MC) > HUtil32.HiWord(M2Share.g_HighMCHuman.m_WAbil.MC))
                            {
                                M2Share.g_HighMCHuman = this;
                            }
                        }
                    }
                    else
                    {
                        M2Share.g_HighMCHuman = this;
                    }
                    nCode = 39;// 最高道术
                    if ((M2Share.g_HighSCHuman != null))
                    {
                        if (M2Share.g_HighSCHuman.m_boGhost)
                        {
                            M2Share.g_HighSCHuman = this;
                        }
                        else
                        {
                            if (HUtil32.HiWord(this.m_WAbil.SC) > HUtil32.HiWord(M2Share.g_HighSCHuman.m_WAbil.SC))
                            {
                                M2Share.g_HighSCHuman = this;
                            }
                        }
                    }
                    else
                    {
                        M2Share.g_HighSCHuman = this;
                    }
                    nCode = 40;// 最长在线时间
                    if ((M2Share.g_HighOnlineHuman != null))
                    {
                        if (M2Share.g_HighOnlineHuman.m_boGhost)
                        {
                            M2Share.g_HighOnlineHuman = this;
                        }
                        else
                        {
                            if (m_dwLogonTick < M2Share.g_HighOnlineHuman.m_dwLogonTick)
                            {
                                M2Share.g_HighOnlineHuman = this;
                            }
                        }
                    }
                    else
                    {
                        M2Share.g_HighOnlineHuman = this;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage(sExceptionMsg3 + nCode);
            }
            try
            {
                if (!m_boNotOnlineAddExp) // 如果是离线挂机的，不检测
                {
                    if (GameConfig.boReNewChangeColor && (m_btReLevel > 0) && (HUtil32.GetTickCount() - m_dwReColorTick > GameConfig.dwReNewNameColorTime))
                    {
                        m_dwReColorTick = HUtil32.GetTickCount();
                        m_btReColorIdx++;
                        if (m_btReColorIdx > GameConfig.ReNewNameColor.GetUpperBound(0))
                        {
                            m_btReColorIdx = 0;
                        }
                        this.m_btNameColor = GameConfig.ReNewNameColor[m_btReColorIdx]; // 名称自动变色
                        this.RefNameColor();
                    }
                    if ((m_GetWhisperHuman != null))   // 检测侦听私聊对像
                    {
                        if (m_GetWhisperHuman.m_boDeath || (m_GetWhisperHuman.m_boGhost))
                        {
                            m_GetWhisperHuman = null;
                        }
                    }
                    ProcessSpiritSuite();
                }
            }
            catch
            {
                M2Share.MainOutMessage("[Exception] TPlayObject::Run Code:" + nCode);
            }
            try
            {
                if (HUtil32.GetTickCount() - m_dwClearObjTick > 60000)   // 1000 * 60
                {
                    m_dwClearObjTick = HUtil32.GetTickCount();
                    if ((m_DearHuman != null) && (m_DearHuman.m_boDeath || m_DearHuman.m_boGhost))
                    {
                        m_DearHuman = null;
                    }
                    if (m_boMaster)
                    {
                        for (int I = m_MasterList.Count - 1; I >= 0; I--)
                        {
                            if (m_MasterList.Count <= 0)
                            {
                                break;
                            }
                            PlayObject = m_MasterList[I];
                            if ((PlayObject != null) && (PlayObject.m_boDeath || PlayObject.m_boGhost))
                            {
                                m_MasterList.RemoveAt(I);
                            }
                        }
                    }
                    else
                    {
                        if ((m_MasterHuman != null) && (m_MasterHuman.m_boDeath || m_MasterHuman.m_boGhost))
                        {
                            m_MasterHuman = null;
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage(sExceptionMsg4);
            }
            try
            {
                if (!m_boNotOnlineAddExp) // 如果是离线挂机的，不检测
                {
                    if ((m_nAutoGetExpPoint > 0) && ((m_AutoGetExpEnvir == null) || (m_AutoGetExpEnvir == this.m_PEnvir))
                        && (HUtil32.GetTickCount() - m_dwAutoGetExpTick > m_nAutoGetExpTime))
                    {
                        m_dwAutoGetExpTick = HUtil32.GetTickCount();
                        if (!m_boAutoGetExpInSafeZone || (m_boAutoGetExpInSafeZone && this.InSafeZone()))
                        {
                            GetExp(m_nAutoGetExpPoint, false, 0);
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject::Run -> AutoGetExp");
            }
            base.Run();
        }

        /// <summary>
        /// 祈祷属性装备
        /// </summary>
        private unsafe void ProcessSpiritSuite()
        {
            TStdItem* StdItem;
            TUserItem* UseItem;
            if (!GameConfig.boSpiritMutiny || !this.m_bopirit)
            {
                return;
            }
            this.m_bopirit = false;
            for (int I = m_UseItems.GetLowerBound(0); I <= m_UseItems.GetUpperBound(0); I++)
            {
                UseItem = (TUserItem*)this.m_UseItems[I];
                if (UseItem->wIndex <= 0)
                {
                    continue;
                }
                StdItem = UserEngine.GetStdItem(UseItem->wIndex);
                if (StdItem != null)
                {
                    if ((StdItem->Shape == 126) || (StdItem->Shape == 127) || (StdItem->Shape == 128) || (StdItem->Shape == 129))
                    {
                        SendDelItems(UseItem);
                        UseItem->wIndex = 0;
                    }
                }
            }
            RecalcAbilitys();
            this.CompareSuitItem(false); //套装
            M2Share.g_dwSpiritMutinyTick = HUtil32.GetTickCount() + GameConfig.dwSpiritMutinyTime;
            UserEngine.SendBroadCastMsg("神之祈祷，天地震怒，尸横遍野...", TMsgType.t_System);
            this.SysMsg("祈祷发出强烈的宇宙效应", TMsgColor.c_Green, TMsgType.t_Hint);
        }

        private void LogonTimcCost()
        {
            uint n08;
            string SC = string.Empty;
            if ((m_nPayMent == 2) || (GameConfig.boTestServer))
            {
                n08 = HUtil32.GetTickCount() - m_dwLogonTick / 1000;
            }
            else
            {
                n08 = 0;
            }
            //SC = m_sIPaddr + "\09" + m_sUserID + "\09" + this.m_sCharName + "\09" + (n08).ToString() + "\09" + FormatDateTime("yyyy-mm-dd hh:mm:ss", m_dLogonTime) + "\09" + FormatDateTime("yyyy-mm-dd hh:mm:ss", DateTime.Now) + "\09" + (m_nPayMode).ToString();
            M2Share.AddLogonCostLog(SC);
            if (m_nPayMode == 2)
            {
                //IdSrvClient.Units.IdSrvClient.FrmIDSoc.SendLogonCostMsg(m_sUserID, n08 / 60);
            }
        }

        /// <summary>
        /// 取下属数量
        /// </summary>
        /// <returns></returns>
        public int MakeSelf_GetSlaveCount()
        {
            return this.m_SlaveList.FindAll(BaseObject =>
            {
                return BaseObject.m_nCopyHumanLevel == 2;
            }).Count();
        }

        public bool MakeSelf_GetPosition1(ref int nX, ref int nY, byte nDir)
        {
            bool result;
            TEnvirnoment Envir;
            Envir = this.m_PEnvir;
            nX = this.m_nCurrX;
            nY = this.m_nCurrY;
            switch (nDir)
            {
                case Grobal2.DR_UP:// 北
                    if (nY > 0)
                    {
                        nY -= 3;
                    }
                    break;
                case Grobal2.DR_UPRIGHT:// 东北向
                    if ((nX < (Envir.m_nWidth - 1)) && (nY > 0))
                    {
                        nX += 3;
                        nY -= 3;
                    }
                    break;
                case Grobal2.DR_RIGHT:// 东
                    if (nX < (Envir.m_nWidth - 1))
                    {
                        nX += 3;
                    }
                    break;
                case Grobal2.DR_DOWNRIGHT:// 东南向
                    if ((nX < (Envir.m_nWidth - 1)) && (nY < (Envir.m_nHeight - 1)))
                    {
                        nX += 3;
                        nY += 3;
                    }
                    break;
                case Grobal2.DR_DOWN:// 正南
                    if (nY < (Envir.m_nHeight - 1))
                    {
                        nY += 3;
                    }
                    break;
                case Grobal2.DR_DOWNLEFT:// 西南向
                    if ((nX > 0) && (nY < (Envir.m_nHeight - 1)))
                    {
                        nX -= 3;
                        nY += 3;
                    }
                    break;
                case Grobal2.DR_LEFT:// 西
                    if (nX > 0)
                    {
                        nX -= 3;
                    }
                    break;
                case Grobal2.DR_UPLEFT:// 西北向
                    if ((nX > 0) && (nY > 0))
                    {
                        nX -= 3;
                        nY -= 3;
                    }
                    break;
            }
            result = true;
            return result;
        }

        /// <summary>
        /// 创建分身
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="sMonName"></param>
        /// <param name="nMaxMob"></param>
        /// <param name="dwRoyaltySec"></param>
        /// <returns></returns>
        public TBaseObject MakeSelf(TPlayObject PlayObject, string sMonName, int nMaxMob, uint dwRoyaltySec)
        {
            TBaseObject result = null;
            int nX = 0;
            int nY = 0;
            TBaseObject MonObj;
            if (MakeSelf_GetSlaveCount() < nMaxMob)
            {
                MakeSelf_GetPosition1(ref nX, ref nY, PlayObject.m_btDirection);  // 分身效果需在主人3格外显示
                MonObj = UserEngine.RegenPlayByName(PlayObject, nX, nY, sMonName);
                if (MonObj != null)
                {
                    MonObj.m_Master = this;
                    MonObj.m_dwMasterRoyaltyTick = dwRoyaltySec * 1000;
                    MonObj.m_dwMasterRoyaltyTime = HUtil32.GetTickCount();
                    MonObj.m_btSlaveMakeLevel = (byte)this.m_Abil.Level;
                    MonObj.m_btSlaveExpLevel = (byte)this.m_Abil.MaxExp;
                    MonObj.m_btNameColor = GameConfig.nCopyHumNameColor;// 分身名字颜色
                    MonObj.RecalcAbilitys();
                    if (MonObj.m_WAbil.HP < MonObj.m_WAbil.MaxHP)
                    {
                        MonObj.m_WAbil.HP = MonObj.m_WAbil.HP + (MonObj.m_WAbil.MaxHP - MonObj.m_WAbil.HP) / 2;
                    }
                    if (PlayObject.m_boPKFlag)
                    {
                        MonObj.m_dwPKTick = PlayObject.m_dwPKTick;
                        MonObj.m_boPKFlag = PlayObject.m_boPKFlag;
                    }
                    if (MonObj.m_btRaceServer == Grobal2.RC_PLAYMOSTER)
                    {
                        ((TPlayMonster)(MonObj)).m_boProtectStatus = false; // 分身没有守护模式
                    }
                    MonObj.RefNameColor();
                    this.m_SlaveList.Add(MonObj);
                    result = MonObj;
                }
            }
            return result;
        }

        /// <summary>
        /// 命令处理部分
        /// </summary>
        /// <param name="sData"></param>
        public void ProcessUserLineMsg(string sData)
        {
            string SC;
            string sCmd = string.Empty;
            string sParam1 = string.Empty;
            string sParam2 = string.Empty;
            string sParam3 = string.Empty;
            string sParam4 = string.Empty;
            string sParam5 = string.Empty;
            string sParam6 = string.Empty;
            string sParam7 = string.Empty;
            TPlayObject PlayObject;
            int nFlag;
            int nValue;
            int nLen;
            const string sExceptionMsg = "{异常} TPlayObject::ProcessUserLineMsg Msg = {0}";
            try
            {
                if (m_boSoftClose)
                {
                    return;
                }
                nLen = sData.Length;
                if (m_boSetStoragePwd)
                {
                    m_boSetStoragePwd = false;
                    if ((nLen > 3) && (nLen < 8))
                    {
                        m_sTempPwd = sData;
                        m_boReConfigPwd = true;
                        this.SysMsg(GameMsgDef.g_sReSetPasswordMsg, TMsgColor.c_Green, TMsgType.t_Hint);//请重复输入一次仓库密码：'
                        this.SendMsg(this, Grobal2.RM_PASSWORD, 0, 0, 0, 0, "");
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sPasswordOverLongMsg, TMsgColor.c_Red, TMsgType.t_Hint);//'输入的密码长度不正确！！！，密码长度必须在 4 - 7 的范围内，请重新设置密码。'
                    }
                    return;
                }
                if (m_boReConfigPwd)
                {
                    m_boReConfigPwd = false;
                    if (m_sTempPwd.CompareTo(sData) == 0)
                    {
                        m_sStoragePwd = sData;
                        m_boPasswordLocked = true;
                        m_boCanGetBackItem = false;
                        m_sTempPwd = "";
                        this.SysMsg(GameMsgDef.g_sReSetPasswordOKMsg, TMsgColor.c_Blue, TMsgType.t_Hint);// '密码设置成功！！，仓库已经自动上锁，请记好您的仓库密码，在取仓库时需要使用此密码开锁。'
                    }
                    else
                    {
                        m_sTempPwd = "";
                        this.SysMsg(GameMsgDef.g_sReSetPasswordNotMatchMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    return;
                }
                if (m_boUnLockPwd || m_boUnLockStoragePwd)
                {
                    if (m_sStoragePwd.CompareTo(sData) == 0)
                    {
                        m_boPasswordLocked = false;
                        if (m_boUnLockPwd)
                        {
                            if (GameConfig.boLockDealAction)
                            {
                                m_boCanDeal = true;
                            }
                            if (GameConfig.boLockDropAction)
                            {
                                m_boCanDrop = true;
                            }
                            if (GameConfig.boLockWalkAction)
                            {
                                m_boCanWalk = true;
                            }
                            if (GameConfig.boLockRunAction)
                            {
                                m_boCanRun = true;
                            }
                            if (GameConfig.boLockHitAction)
                            {
                                m_boCanHit = true;
                            }
                            if (GameConfig.boLockSpellAction)
                            {
                                m_boCanSpell = true;
                            }
                            if (GameConfig.boLockCallHeroAction)
                            {
                                m_boCallHero = true;
                            }
                            if (GameConfig.boLockSendMsgAction)// 是否锁定召唤英雄操作
                            {
                                m_boCanSendMsg = true;
                            }
                            if (GameConfig.boLockUserItemAction)
                            {
                                m_boCanUseItem = true;
                            }
                            if (GameConfig.boLockInObModeAction)
                            {
                                this.m_boObMode = false;
                                this.m_boAdminMode = false;
                            }
                            m_boLockLogoned = true;
                            this.SysMsg(GameMsgDef.g_sPasswordUnLockOKMsg, TMsgColor.c_Blue, TMsgType.t_Hint);
                        }
                        if (m_boUnLockStoragePwd)
                        {
                            if (GameConfig.boLockGetBackItemAction)
                            {
                                m_boCanGetBackItem = true;
                            }
                            this.SysMsg(GameMsgDef.g_sStorageUnLockOKMsg, TMsgColor.c_Blue, TMsgType.t_Hint);
                        }
                    }
                    else
                    {
                        m_btPwdFailCount++;
                        this.SysMsg(GameMsgDef.g_sUnLockPasswordFailMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                        if (m_btPwdFailCount > 3)
                        {
                            this.SysMsg(GameMsgDef.g_sStoragePasswordLockedMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                    }
                    m_boUnLockPwd = false;
                    m_boUnLockStoragePwd = false;
                    return;
                }
                if (m_boCheckOldPwd)
                {
                    m_boCheckOldPwd = false;
                    if (m_sStoragePwd == sData)
                    {
                        this.SendMsg(this, Grobal2.RM_PASSWORD, 0, 0, 0, 0, "");
                        this.SysMsg(GameMsgDef.g_sSetPasswordMsg, TMsgColor.c_Green, TMsgType.t_Hint);
                        m_boSetStoragePwd = true;
                    }
                    else
                    {
                        m_btPwdFailCount++;
                        this.SysMsg(GameMsgDef.g_sOldPasswordIncorrectMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                        if (m_btPwdFailCount > 3)
                        {
                            this.SysMsg(GameMsgDef.g_sStoragePasswordLockedMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                            m_boPasswordLocked = true;
                        }
                    }
                    return;
                }
                if (sData[0] != '@')
                {
                    if (sData.Length > GameConfig.nSayMsgMaxLen)
                    {
                        sData = sData.Substring(1 - 1, GameConfig.nSayMsgMaxLen);
                    }
                    if (M2Share.IsFilterMsg(ref sData))
                    {
                        ProcessSayMsg(sData);  // 文字过滤
                    }
                    return;
                }
                SC = sData.Substring(2 - 1, sData.Length - 1);
                SC = HUtil32.GetValidStr3(SC, ref sCmd, new string[] { " ", ":", ",", "\09" });
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.SysMsg.sCmd).ToLower()) == 0)
                {
                    CmdSysMsg(M2Share.g_GameCommand.SysMsg, SC); // 千里传音 
                    return;
                }
                if (SC != "")
                {
                    SC = HUtil32.GetValidStr3(SC, ref sParam1, new string[] { " ", ":", ",", "\09" });
                }
                if (SC != "")
                {
                    SC = HUtil32.GetValidStr3(SC, ref sParam2, new string[] { " ", ":", ",", "\09" });
                }
                if (SC != "")
                {
                    SC = HUtil32.GetValidStr3(SC, ref sParam3, new string[] { " ", ":", ",", "\09" });
                }
                if (SC != "")
                {
                    SC = HUtil32.GetValidStr3(SC, ref sParam4, new string[] { " ", ":", ",", "\09" });
                }
                if (SC != "")
                {
                    SC = HUtil32.GetValidStr3(SC, ref sParam5, new string[] { " ", ":", ",", "\09" });
                }
                if (SC != "")
                {
                    SC = HUtil32.GetValidStr3(SC, ref sParam6, new string[] { " ", ":", ",", "\09" });
                }
                if (SC != "")
                {
                    SC = HUtil32.GetValidStr3(SC, ref sParam7, new string[] { " ", ":", ",", "\09" });
                }

                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.PASSWORDLOCK.sCmd).ToLower()) == 0)
                {
                    if (!GameConfig.boPasswordLockSystem)
                    {
                        this.SysMsg(GameMsgDef.g_sNoPasswordLockSystemMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                        return;
                    }
                    if (m_sStoragePwd == "")
                    {
                        this.SendMsg(this, Grobal2.RM_PASSWORD, 0, 0, 0, 0, "");
                        m_boSetStoragePwd = true;
                        this.SysMsg(GameMsgDef.g_sSetPasswordMsg, TMsgColor.c_Green, TMsgType.t_Hint);
                        return;
                    }
                    if (m_btPwdFailCount > 3)
                    {
                        this.SysMsg(GameMsgDef.g_sStoragePasswordLockedMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                        m_boPasswordLocked = true;
                        return;
                    }
                    if (m_sStoragePwd != "")
                    {
                        this.SendMsg(this, Grobal2.RM_PASSWORD, 0, 0, 0, 0, "");
                        m_boCheckOldPwd = true;
                        this.SysMsg(GameMsgDef.g_sPleaseInputOldPasswordMsg, TMsgColor.c_Green, TMsgType.t_Hint);
                        return;
                    }
                    return;
                }
                // 新密码命令
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.SETPASSWORD.sCmd).ToLower()) == 0)
                {
                    if (!GameConfig.boPasswordLockSystem)
                    {
                        this.SysMsg(GameMsgDef.g_sNoPasswordLockSystemMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                        return;
                    }
                    if (m_sStoragePwd == "")
                    {
                        this.SendMsg(this, Grobal2.RM_PASSWORD, 0, 0, 0, 0, "");
                        m_boSetStoragePwd = true;
                        this.SysMsg(GameMsgDef.g_sSetPasswordMsg, TMsgColor.c_Green, TMsgType.t_Hint);
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sAlreadySetPasswordMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.UNPASSWORD.sCmd).ToLower()) == 0)
                {
                    if (!GameConfig.boPasswordLockSystem)
                    {
                        this.SysMsg(GameMsgDef.g_sNoPasswordLockSystemMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                        return;
                    }
                    if (!m_boPasswordLocked)
                    {
                        m_sStoragePwd = "";
                        this.SysMsg(GameMsgDef.g_sOldPasswordIsClearMsg, TMsgColor.c_Green, TMsgType.t_Hint);
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sPleaseUnLockPasswordMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.CHGPASSWORD.sCmd).ToLower()) == 0)
                {
                    if (!GameConfig.boPasswordLockSystem)
                    {
                        this.SysMsg(GameMsgDef.g_sNoPasswordLockSystemMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                        return;
                    }
                    if (m_btPwdFailCount > 3)
                    {
                        this.SysMsg(GameMsgDef.g_sStoragePasswordLockedMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                        m_boPasswordLocked = true;
                        return;
                    }
                    if (m_sStoragePwd != "")
                    {
                        this.SendMsg(this, Grobal2.RM_PASSWORD, 0, 0, 0, 0, "");
                        m_boCheckOldPwd = true;
                        this.SysMsg(GameMsgDef.g_sPleaseInputOldPasswordMsg, TMsgColor.c_Green, TMsgType.t_Hint);
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sNoPasswordSetMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.UNLOCKSTORAGE.sCmd).ToLower()) == 0)
                {
                    if (!GameConfig.boPasswordLockSystem)
                    {
                        this.SysMsg(GameMsgDef.g_sNoPasswordLockSystemMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                        return;
                    }
                    if (m_btPwdFailCount > GameConfig.nPasswordErrorCountLock)
                    {
                        this.SysMsg(GameMsgDef.g_sStoragePasswordLockedMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                        m_boPasswordLocked = true;
                        return;
                    }
                    if (m_sStoragePwd != "")
                    {
                        if (!m_boUnLockStoragePwd)
                        {
                            this.SendMsg(this, Grobal2.RM_PASSWORD, 0, 0, 0, 0, "");
                            this.SysMsg(GameMsgDef.g_sPleaseInputUnLockPasswordMsg, TMsgColor.c_Green, TMsgType.t_Hint);
                            m_boUnLockStoragePwd = true;
                        }
                        else
                        {
                            this.SysMsg(GameMsgDef.g_sStorageAlreadyUnLockMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sStorageNoPasswordMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.UnLock.sCmd).ToLower()) == 0)
                {
                    if (!GameConfig.boPasswordLockSystem)
                    {
                        this.SysMsg(GameMsgDef.g_sNoPasswordLockSystemMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                        return;
                    }
                    if (m_btPwdFailCount > GameConfig.nPasswordErrorCountLock)
                    {
                        this.SysMsg(GameMsgDef.g_sStoragePasswordLockedMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                        m_boPasswordLocked = true;
                        return;
                    }
                    if (m_sStoragePwd != "")
                    {
                        if (!m_boUnLockPwd)
                        {
                            this.SendMsg(this, Grobal2.RM_PASSWORD, 0, 0, 0, 0, "");
                            this.SysMsg(GameMsgDef.g_sPleaseInputUnLockPasswordMsg, TMsgColor.c_Green, TMsgType.t_Hint);
                            m_boUnLockPwd = true;
                        }
                        else
                        {
                            this.SysMsg(GameMsgDef.g_sStorageAlreadyUnLockMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sStorageNoPasswordMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.__Lock.sCmd).ToLower()) == 0)
                {
                    if (!GameConfig.boPasswordLockSystem)
                    {
                        this.SysMsg(GameMsgDef.g_sNoPasswordLockSystemMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                        return;
                    }
                    if (!m_boPasswordLocked)
                    {
                        if (m_sStoragePwd != "")
                        {
                            m_boPasswordLocked = true;
                            m_boCanGetBackItem = false;
                            this.SysMsg(GameMsgDef.g_sLockStorageSuccessMsg, TMsgColor.c_Green, TMsgType.t_Hint);
                        }
                        else
                        {
                            this.SysMsg(GameMsgDef.g_sStorageNoPasswordMsg, TMsgColor.c_Green, TMsgType.t_Hint);
                        }
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sStorageAlreadyLockMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    return;
                }
                if (PlayObjectUserCmd(sCmd, sParam1))// 自定义命令
                {
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.MEMBERFUNCTION.sCmd).ToLower()) == 0)
                {
                    CmdMemberFunction(M2Share.g_GameCommand.MEMBERFUNCTION.sCmd, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.MEMBERFUNCTIONEX.sCmd).ToLower()) == 0)
                {
                    //CmdMemberFunctionEx(M2Share.g_GameCommand.MEMBERFUNCTIONEX.sCmd, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.REMTEMSG.sCmd).ToLower()) == 0)
                {
                    m_boRemoteMsg = true;
                    this.SysMsg("允许接受消息。", TMsgColor.c_Green, TMsgType.t_Hint);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.DEAR.sCmd).ToLower()) == 0)
                {
                    CmdSearchDear(M2Share.g_GameCommand.DEAR.sCmd, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.MASTER.sCmd).ToLower()) == 0)
                {
                    //CmdSearchMaster(M2Share.g_GameCommand.MASTER.sCmd, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.MASTERECALL.sCmd).ToLower()) == 0)
                {
                    CmdMasterRecall(M2Share.g_GameCommand.MASTERECALL.sCmd, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.DEARRECALL.sCmd).ToLower()) == 0)
                {
                    CmdDearRecall(M2Share.g_GameCommand.DEARRECALL.sCmd, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.ALLOWDEARRCALL.sCmd).ToLower()) == 0)
                {
                    m_boCanDearRecall = !m_boCanDearRecall;
                    if (m_boCanDearRecall)
                    {
                        this.SysMsg(GameMsgDef.g_sEnableDearRecall, TMsgColor.c_Blue, TMsgType.t_Hint);// '允许夫妻传送！！！'
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sDisableDearRecall, TMsgColor.c_Blue, TMsgType.t_Hint);// '禁止夫妻传送！！！
                    }
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.ALLOWMASTERRECALL.sCmd).ToLower()) == 0)
                {
                    m_boCanMasterRecall = !m_boCanMasterRecall;
                    if (m_boCanMasterRecall)
                    {
                        this.SysMsg(GameMsgDef.g_sEnableMasterRecall, TMsgColor.c_Blue, TMsgType.t_Hint);  // '允许师徒传送！！！'
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sDisableMasterRecall, TMsgColor.c_Blue, TMsgType.t_Hint);// '禁止师徒传送！！！'
                    }
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.Data.sCmd).ToLower()) == 0)
                {
                    // '当前日期时间: '
                    //this.SysMsg(GameMsgDef.g_sNowCurrDateTime + FormatDateTime("dddddd,dddd,hh:mm:nn", DateTime.Now), TMsgColor.c_Blue, TMsgType.t_Hint);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.PRVMSG.sCmd).ToLower()) == 0)
                {
                    CmdPrvMsg(M2Share.g_GameCommand.PRVMSG.sCmd, M2Share.g_GameCommand.PRVMSG.nPermissionMin, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.AllowReAlive.sCmd).ToLower()) == 0)
                {
                    m_boAllowReAlive = !m_boAllowReAlive;
                    if (m_boAllowReAlive)
                    {
                        this.SysMsg(GameMsgDef.g_sEnableAllowRebirth, TMsgColor.c_Green, TMsgType.t_Hint);  // '[允许复活]'
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sDisableAllowRebirth, TMsgColor.c_Green, TMsgType.t_Hint);// '[禁止复活]'
                    }
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.UserItem.sCmd).ToLower()) == 0)
                {
                    CmdGetUserItems(M2Share.g_GameCommand.UserItem, sParam1, sParam2, sParam3, sParam4);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.SIGNMOVE.sCmd).ToLower()) == 0)
                {
                    CmdSignMapMove(M2Share.g_GameCommand.UserItem);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.CLEARCOPYITEM.sCmd).ToLower()) == 0)
                {
                    CmdClearCopyItem(M2Share.g_GameCommand.CLEARCOPYITEM, sParam1); // 清理指定玩家复制品
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.SHOWEFFECT.sCmd).ToLower()) == 0)
                {
                    //CmdShowEffect(M2Share.g_GameCommand.SHOWEFFECT, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.ALLOWMSG.sCmd).ToLower()) == 0)
                {
                    m_boHearWhisper = !m_boHearWhisper;
                    if (m_boHearWhisper)
                    {
                        this.SysMsg(GameMsgDef.g_sEnableHearWhisper, TMsgColor.c_Green, TMsgType.t_Hint); // '[允许私聊]'
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sDisableHearWhisper, TMsgColor.c_Green, TMsgType.t_Hint); // '[禁止私聊]'
                    }
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.LETSHOUT.sCmd).ToLower()) == 0)
                {
                    m_boBanShout = !m_boBanShout;
                    if (m_boBanShout)
                    {
                        this.SysMsg(GameMsgDef.g_sEnableShoutMsg, TMsgColor.c_Green, TMsgType.t_Hint);// '[允许群聊]'
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sDisableShoutMsg, TMsgColor.c_Green, TMsgType.t_Hint);// '[禁止群聊]'
                    }
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.BANGMMSG.sCmd).ToLower()) == 0)
                {
                    m_boBanGmMsg = !m_boBanGmMsg;// 拒绝所有喊话信息
                    if (m_boBanGmMsg)
                    {
                        this.SysMsg(GameMsgDef.g_sEnableBANGMMSG, TMsgColor.c_Green, TMsgType.t_Hint);// '[允许接收喊话]'
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sDisableBANGMMSG, TMsgColor.c_Green, TMsgType.t_Hint); // '[禁止接收喊话]'
                    }
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.LETTRADE.sCmd).ToLower()) == 0)
                {
                    m_boAllowDeal = !m_boAllowDeal;
                    if (m_boAllowDeal)
                    {
                        this.SysMsg(GameMsgDef.g_sEnableDealMsg, TMsgColor.c_Green, TMsgType.t_Hint); // '[允许交易]'
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sDisableDealMsg, TMsgColor.c_Green, TMsgType.t_Hint);  // '[禁止交易]'
                    }
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.BANGUILDCHAT.sCmd).ToLower()) == 0)
                {
                    m_boBanGuildChat = !m_boBanGuildChat;
                    if (m_boBanGuildChat)
                    {
                        this.SysMsg(GameMsgDef.g_sEnableGuildChat, TMsgColor.c_Green, TMsgType.t_Hint);// '[允许行会聊天]'
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sDisableGuildChat, TMsgColor.c_Green, TMsgType.t_Hint);// '[禁止行会聊天]'
                    }
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.LETGUILD.sCmd).ToLower()) == 0)
                {
                    m_boAllowGuild = !m_boAllowGuild;
                    if (m_boAllowGuild)
                    {
                        this.SysMsg(GameMsgDef.g_sEnableJoinGuild, TMsgColor.c_Green, TMsgType.t_Hint); // '[允许加入行会]'
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sDisableJoinGuild, TMsgColor.c_Green, TMsgType.t_Hint); // '[禁止加入行会]'
                    }
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.ENDGUILD.sCmd).ToLower()) == 0)
                {
                    CmdEndGuild(); // 退出行会
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.AUTHALLY.sCmd).ToLower()) == 0)
                {
                    if (this.IsGuildMaster())
                    {
                        (this.m_MyGuild).m_boEnableAuthAlly = !(this.m_MyGuild).m_boEnableAuthAlly;
                        if ((this.m_MyGuild).m_boEnableAuthAlly)
                        {
                            this.SysMsg(GameMsgDef.g_sEnableAuthAllyGuild, TMsgColor.c_Green, TMsgType.t_Hint);// '[允许行会联盟]'
                        }
                        else
                        {
                            this.SysMsg(GameMsgDef.g_sDisableAuthAllyGuild, TMsgColor.c_Green, TMsgType.t_Hint);// '[禁止行会联盟]'
                        }
                    }
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.ALLOWGUILDRECALL.sCmd).ToLower()) == 0)
                {
                    m_boAllowGuildReCall = !m_boAllowGuildReCall;
                    if (m_boAllowGuildReCall)
                    {
                        this.SysMsg(GameMsgDef.g_sEnableGuildRecall, TMsgColor.c_Green, TMsgType.t_Hint); // '[允许行会合一]'
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sDisableGuildRecall, TMsgColor.c_Green, TMsgType.t_Hint);  // '[禁止行会合一]'
                    }
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.AUTH.sCmd).ToLower()) == 0)
                {
                    if (this.IsGuildMaster())
                    {
                        ClientGuildAlly();
                    }
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.AUTHCANCEL.sCmd).ToLower()) == 0)
                {
                    if (this.IsGuildMaster())
                    {
                        ClientGuildBreakAlly(sParam1);
                    }
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.REST.sCmd).ToLower()) == 0)
                {
                    CmdChangeSalveStatus();// 改变下属状态
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.TAKEONHORSE.sCmd).ToLower()) == 0)
                {
                    CmdTakeOnHorse(sCmd, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.TAKEOFHORSE.sCmd).ToLower()) == 0)
                {
                    CmdTakeOffHorse(sCmd, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.MAPINFO.sCmd).ToLower()) == 0)
                {
                    ShowMapInfo(sParam1, sParam2, sParam3);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.SHOWUSEITEMINFO.sCmd).ToLower()) == 0)
                {
                    CmdShowUseItemInfo(M2Share.g_GameCommand.SHOWUSEITEMINFO, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.BINDUSEITEM.sCmd).ToLower()) == 0)
                {
                    CmdBindUseItem(M2Share.g_GameCommand.BINDUSEITEM, sParam1, sParam2, sParam3);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.USERMOVE.sCmd).ToLower()) == 0)
                {
                    CmdUserMoveXY(M2Share.g_GameCommand.USERMOVE.sCmd, sParam1, sParam2);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.SEARCHING.sCmd).ToLower()) == 0)
                {
                    CmdSearchHuman(M2Share.g_GameCommand.SEARCHING.sCmd, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.LOCKLOGON.sCmd).ToLower()) == 0)
                {
                    //CmdLockLogin(M2Share.g_GameCommand.LOCKLOGON);
                    return;
                }
                if ((this.m_btPermission >= 2) && (sData.Length > 2))
                {
                    if ((this.m_btPermission >= 6) && (sData[2] == M2Share.g_GMRedMsgCmd))
                    {
                        if (HUtil32.GetTickCount() - m_dwSayMsgTick > 2000)
                        {
                            m_dwSayMsgTick = HUtil32.GetTickCount();
                            sData = sData.Substring(3 - 1, sData.Length - 2);
                            if (sData.Length > GameConfig.nSayRedMsgMaxLen)
                            {
                                sData = sData.Substring(1 - 1, GameConfig.nSayRedMsgMaxLen);
                            }
                            if (GameConfig.boShutRedMsgShowGMName)
                            {
                                SC = this.m_sCharName + ": " + sData;
                            }
                            else
                            {
                                SC = sData;
                            }
                            UserEngine.SendBroadCastMsg(SC, TMsgType.t_GM);
                        }
                        return;
                    }
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.HUMANLOCAL.sCmd).ToLower()) == 0)
                {
                    CmdHumanLocal(M2Share.g_GameCommand.HUMANLOCAL, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.Move.sCmd).ToLower()) == 0)
                {
                    CmdMapMove(M2Share.g_GameCommand.Move, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.POSITIONMOVE.sCmd).ToLower()) == 0)
                {
                    CmdPositionMove(M2Share.g_GameCommand.POSITIONMOVE, sParam1, sParam2, sParam3);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.HUMANCOUNT.sCmd).ToLower()) == 0)
                {
                    CmdHumanCount(M2Share.g_GameCommand.HUMANCOUNT, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.KICK.sCmd).ToLower()) == 0)
                {
                    CmdKickHuman(M2Share.g_GameCommand.KICK, sParam1);
                    return;
                }
                //if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.TING.sCmd).ToLower()) == 0)
                //{
                //    CmdTing(M2Share.g_GameCommand.TING, sParam1);
                //    return;
                //}
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.SUPERTING.sCmd).ToLower()) == 0)
                {
                    CmdSuperTing(M2Share.g_GameCommand.SUPERTING, sParam1, sParam2);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.MAPMOVE.sCmd).ToLower()) == 0)
                {
                    CmdMapMoveHuman(M2Share.g_GameCommand.MAPMOVE, sParam1, sParam2);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.SHUTUP.sCmd).ToLower()) == 0)
                {
                    CmdShutup(M2Share.g_GameCommand.SHUTUP, sParam1, sParam2);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.Map.sCmd).ToLower()) == 0)
                {
                    CmdShowMapInfo(M2Share.g_GameCommand.Map, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.RELEASESHUTUP.sCmd).ToLower()) == 0)
                {
                    CmdShutupRelease(M2Share.g_GameCommand.RELEASESHUTUP, sParam1, true);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.SHUTUPLIST.sCmd).ToLower()) == 0)
                {
                    CmdShutupList(M2Share.g_GameCommand.SHUTUPLIST, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.GAMEMASTER.sCmd).ToLower()) == 0)
                {
                    CmdChangeAdminMode(M2Share.g_GameCommand.GAMEMASTER.sCmd, M2Share.g_GameCommand.GAMEMASTER.nPermissionMin, sParam1, !this.m_boAdminMode);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.OBSERVER.sCmd).ToLower()) == 0)
                {
                    CmdChangeObMode(M2Share.g_GameCommand.OBSERVER.sCmd, M2Share.g_GameCommand.OBSERVER.nPermissionMin, sParam1, !this.m_boObMode);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.SUEPRMAN.sCmd).ToLower()) == 0)
                {
                    CmdChangeSuperManMode(M2Share.g_GameCommand.OBSERVER.sCmd, M2Share.g_GameCommand.OBSERVER.nPermissionMin, sParam1, !this.m_boSuperMan);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.Level.sCmd).ToLower()) == 0)
                {
                    //CmdChangeLevel(M2Share.g_GameCommand.Level, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.SABUKWALLGOLD.sCmd).ToLower()) == 0)
                {
                    CmdShowSbkGold(M2Share.g_GameCommand.SABUKWALLGOLD, sParam1, sParam2, sParam3);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.RECALL.sCmd).ToLower()) == 0)
                {
                    CmdRecallHuman(M2Share.g_GameCommand.RECALL, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.REGOTO.sCmd).ToLower()) == 0)
                {
                    CmdReGotoHuman(M2Share.g_GameCommand.REGOTO, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.SHOWFLAG.sCmd).ToLower()) == 0)
                {
                    CmdShowHumanFlag(M2Share.g_GameCommand.SHOWFLAG.sCmd, M2Share.g_GameCommand.SHOWFLAG.nPermissionMin, sParam1, sParam2);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.MOB.sCmd).ToLower()) == 0)
                {
                    //CmdMob(M2Share.g_GameCommand.MOB, sParam1, HUtil32.Str_ToInt(sParam2, 0), HUtil32.Str_ToInt(sParam3, 0), HUtil32.Str_ToInt(sParam4, 0));
                    return;
                };
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.NPCSCRIPT.sCmd).ToLower()) == 0)
                {
                    //CmdNpcScript(M2Share.g_GameCommand.NPCSCRIPT.sCmd, M2Share.g_GameCommand.NPCSCRIPT.nPermissionMin, sParam1, sParam2, sParam3);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.DELNPC.sCmd).ToLower()) == 0)
                {
                    //CmdDelNpc(M2Share.g_GameCommand.DELNPC.sCmd, M2Share.g_GameCommand.DELNPC.nPermissionMin, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.RECALLMOB.sCmd).ToLower()) == 0)
                {
                    //CmdRecallMob(M2Share.g_GameCommand.RECALLMOB, sParam1, HUtil32.Str_ToInt(sParam2, 0), HUtil32.Str_ToInt(sParam3, 0), HUtil32.Str_ToInt(sParam4, 0), HUtil32.Str_ToInt(sParam5, 0));
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.RECALLMOBEX.sCmd).ToLower()) == 0)
                {
                    CmdRECALLMOBEX(M2Share.g_GameCommand.RECALLMOBEX, sParam1, HUtil32.Str_ToInt(sParam2, 0), HUtil32.Str_ToInt(sParam3, 0), HUtil32.Str_ToInt(sParam4, 0));// 召唤宝宝
                    return;
                }
                //if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.GIVEMINE.sCmd).ToLower()) == 0)
                //{
                //    CmdGIVEMINE(M2Share.g_GameCommand.GIVEMINE, sParam1, HUtil32.Str_ToInt(sParam2, 0), HUtil32.Str_ToInt(sParam3, 0)); // 给指定纯度的矿石
                //    return;
                //}
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.MOVEMOBTO.sCmd).ToLower()) == 0)
                {
                    CmdMOVEMOBTO(M2Share.g_GameCommand.MOVEMOBTO, sParam1, sParam2, sParam5, HUtil32.Str_ToInt(sParam3, 0),
                        HUtil32.Str_ToInt(sParam4, 0), HUtil32.Str_ToInt(sParam6, 0), HUtil32.Str_ToInt(sParam7, 0)); // 将指定坐标的怪物移动到新坐标
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.LUCKYPOINT.sCmd).ToLower()) == 0)
                {
                    CmdLuckPoint(M2Share.g_GameCommand.LUCKYPOINT.sCmd, M2Share.g_GameCommand.LUCKYPOINT.nPermissionMin, sParam1, sParam2, sParam3);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.LOTTERYTICKET.sCmd).ToLower()) == 0)
                {
                    CmdLotteryTicket(M2Share.g_GameCommand.LOTTERYTICKET.sCmd, M2Share.g_GameCommand.LOTTERYTICKET.nPermissionMin, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.RELOADGUILD.sCmd).ToLower()) == 0)
                {
                    CmdReloadGuild(M2Share.g_GameCommand.RELOADGUILD.sCmd, M2Share.g_GameCommand.RELOADGUILD.nPermissionMin, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.RELOADLINENOTICE.sCmd).ToLower()) == 0)
                {
                    CmdReloadLineNotice(M2Share.g_GameCommand.RELOADLINENOTICE.sCmd, M2Share.g_GameCommand.RELOADLINENOTICE.nPermissionMin, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.RELOADABUSE.sCmd).ToLower()) == 0)
                {
                    CmdReloadAbuse(M2Share.g_GameCommand.RELOADABUSE.sCmd, M2Share.g_GameCommand.RELOADABUSE.nPermissionMin, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.FREEPENALTY.sCmd).ToLower()) == 0)
                {
                    CmdFreePenalty(M2Share.g_GameCommand.FREEPENALTY, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.IncPkPoint.sCmd).ToLower()) == 0)
                {
                    CmdIncPkPoint(M2Share.g_GameCommand.IncPkPoint, sParam1, HUtil32.Str_ToInt(sParam2, 0));
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.VIEWWHISPER.sCmd).ToLower()) == 0)
                {
                    CmdViewWhisper(M2Share.g_GameCommand.VIEWWHISPER, sParam1, sParam2);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.SMAKE.sCmd).ToLower()) == 0)
                {
                    CmdSmakeItem(M2Share.g_GameCommand.SMAKE, HUtil32.Str_ToInt(sParam1, 0), HUtil32.Str_ToInt(sParam2, 0), HUtil32.Str_ToInt(sParam3, 0));
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.HAIR.sCmd).ToLower()) == 0)
                {
                    CmdHair(M2Share.g_GameCommand.HAIR, sParam1, HUtil32.Str_ToInt(sParam2, 0));
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.BonusPoint.sCmd).ToLower()) == 0)
                {
                    CmdBonuPoint(M2Share.g_GameCommand.BonusPoint, sParam1, HUtil32.Str_ToInt(sParam2, 0));
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.DELBONUSPOINT.sCmd).ToLower()) == 0)
                {
                    CmdDelBonuPoint(M2Share.g_GameCommand.DELBONUSPOINT, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.RESTBONUSPOINT.sCmd).ToLower()) == 0)
                {
                    CmdRestBonuPoint(M2Share.g_GameCommand.RESTBONUSPOINT, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.SETPERMISSION.sCmd).ToLower()) == 0)
                {
                    CmdSetPermission(M2Share.g_GameCommand.SETPERMISSION, sParam1, sParam2);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.RENEWLEVEL.sCmd).ToLower()) == 0)
                {
                    CmdReNewLevel(M2Share.g_GameCommand.RENEWLEVEL, sParam1, sParam2);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.GAMEDIAMOND.sCmd).ToLower()) == 0)
                {
                    CmdGameDiaMond(M2Share.g_GameCommand.GAMEDIAMOND, sParam1, sParam2, HUtil32.Str_ToInt(sParam3, 0));//金刚石
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.GAMEGIRD.sCmd).ToLower()) == 0)
                {
                    CmdGameGird(M2Share.g_GameCommand.GAMEGIRD, sParam1, sParam2, HUtil32.Str_ToInt(sParam3, 0)); //灵符
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.GAMEGLORY.sCmd).ToLower()) == 0)
                {
                    CmdGameGlory(M2Share.g_GameCommand.GAMEGLORY, sParam1, sParam2, (byte)HUtil32.Str_ToInt(sParam3, 0));
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.HEROLOYAL.sCmd).ToLower()) == 0)
                {
                    //英雄的忠诚度
                    CmdHeroLoyal(M2Share.g_GameCommand.HEROLOYAL, sParam1, HUtil32.Str_ToInt(sParam2, 0));
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.CREDITPOINT.sCmd).ToLower()) == 0)
                {
                    CmdCreditPoint(M2Share.g_GameCommand.CREDITPOINT, sParam1, sParam2, HUtil32.Str_ToInt(sParam3, 0));
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.DELETEITEM.sCmd).ToLower()) == 0)
                {
                    CmdDeleteItem(M2Share.g_GameCommand.DELETEITEM, sParam1, sParam2, HUtil32.Str_ToInt(sParam3, 1));
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.CLEARMISSION.sCmd).ToLower()) == 0)
                {
                    CmdClearMission(M2Share.g_GameCommand.CLEARMISSION, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.STARTQUEST.sCmd).ToLower()) == 0)
                {
                    CmdStartQuest(M2Share.g_GameCommand.STARTQUEST, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.DENYIPLOGON.sCmd).ToLower()) == 0)
                {
                    CmdDenyIPaddrLogon(M2Share.g_GameCommand.DENYIPLOGON, sParam1, sParam2);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.CHANGEDEARNAME.sCmd).ToLower()) == 0)
                {
                    CmdChangeDearName(M2Share.g_GameCommand.CHANGEDEARNAME, sParam1, sParam2);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.CHANGEMASTERNAME.sCmd).ToLower()) == 0)
                {
                    CmdChangeMasterName(M2Share.g_GameCommand.CHANGEMASTERNAME, sParam1, sParam2, sParam3);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.CLEARMON.sCmd).ToLower()) == 0)
                {
                    //CmdClearMapMonster(M2Share.g_GameCommand.CLEARMON, sParam1, sParam2, sParam3);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.DENYACCOUNTLOGON.sCmd).ToLower()) == 0)
                {
                    CmdDenyAccountLogon(M2Share.g_GameCommand.DENYACCOUNTLOGON, sParam1, sParam2);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.DENYCHARNAMELOGON.sCmd).ToLower()) == 0)
                {
                    CmdDenyCharNameLogon(M2Share.g_GameCommand.DENYCHARNAMELOGON, sParam1, sParam2);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.DELDENYIPLOGON.sCmd).ToLower()) == 0)
                {
                    CmdDelDenyIPaddrLogon(M2Share.g_GameCommand.DELDENYIPLOGON, sParam1, sParam2);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.DELDENYACCOUNTLOGON.sCmd).ToLower()) == 0)
                {
                    CmdDelDenyAccountLogon(M2Share.g_GameCommand.DELDENYACCOUNTLOGON, sParam1, sParam2);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.DELDENYCHARNAMELOGON.sCmd).ToLower()) == 0)
                {
                    CmdDelDenyCharNameLogon(M2Share.g_GameCommand.DELDENYCHARNAMELOGON, sParam1, sParam2);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.SHOWDENYIPLOGON.sCmd).ToLower()) == 0)
                {
                    CmdShowDenyIPaddrLogon(M2Share.g_GameCommand.SHOWDENYIPLOGON, sParam1, sParam2);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.SHOWDENYACCOUNTLOGON.sCmd).ToLower()) == 0)
                {
                    CmdShowDenyAccountLogon(M2Share.g_GameCommand.SHOWDENYACCOUNTLOGON, sParam1, sParam2);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.SHOWDENYCHARNAMELOGON.sCmd).ToLower()) == 0)
                {
                    CmdShowDenyCharNameLogon(M2Share.g_GameCommand.SHOWDENYCHARNAMELOGON, sParam1, sParam2);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.Mission.sCmd).ToLower()) == 0)
                {
                    CmdMission(M2Share.g_GameCommand.Mission, sParam1, sParam2);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.MobPlace.sCmd).ToLower()) == 0)
                {
                    //CmdMobPlace(M2Share.g_GameCommand.MobPlace, sParam1, sParam2, sParam3, sParam4, sParam5);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.SetMapMode.sCmd).ToLower()) == 0)
                {
                    CmdSetMapMode(M2Share.g_GameCommand.SetMapMode.sCmd, sParam1, sParam2, sParam3, sParam4);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.SHOWMAPMODE.sCmd).ToLower()) == 0)
                {
                    CmdShowMapMode(M2Share.g_GameCommand.SHOWMAPMODE.sCmd, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.CLRPASSWORD.sCmd).ToLower()) == 0)
                {
                    CmdClearHumanPassword(M2Share.g_GameCommand.CLRPASSWORD.sCmd, M2Share.g_GameCommand.CLRPASSWORD.nPermissionMin, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.CONTESTPOINT.sCmd).ToLower()) == 0)
                {
                    CmdContestPoint(M2Share.g_GameCommand.CONTESTPOINT, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.STARTCONTEST.sCmd).ToLower()) == 0)
                {
                    CmdStartContest(M2Share.g_GameCommand.STARTCONTEST, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.ENDCONTEST.sCmd).ToLower()) == 0)
                {
                    CmdEndContest(M2Share.g_GameCommand.ENDCONTEST, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.ANNOUNCEMENT.sCmd).ToLower()) == 0)
                {
                    CmdAnnouncement(M2Share.g_GameCommand.ANNOUNCEMENT, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.DISABLESENDMSG.sCmd).ToLower()) == 0)
                {
                    CmdDisableSendMsg(M2Share.g_GameCommand.DISABLESENDMSG, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.ENABLESENDMSG.sCmd).ToLower()) == 0)
                {
                    CmdEnableSendMsg(M2Share.g_GameCommand.ENABLESENDMSG, sParam1);
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.REFINEWEAPON.sCmd).ToLower()) == 0)
                {
                    CmdRefineWeapon(M2Share.g_GameCommand.REFINEWEAPON, HUtil32.Str_ToInt(sParam1, 0), HUtil32.Str_ToInt(sParam2, 0), HUtil32.Str_ToInt(sParam3, 0), HUtil32.Str_ToInt(sParam4, 0));
                    return;
                }
                if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.DISABLESENDMSGLIST.sCmd).ToLower()) == 0)
                {
                    CmdDisableSendMsgList(M2Share.g_GameCommand.DISABLESENDMSGLIST);
                    return;
                }
                if (this.m_btPermission > 4)
                {
                    if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.BACKSTEP.sCmd).ToLower()) == 0)
                    {
                        CmdBackStep(sCmd, HUtil32.Str_ToInt(sParam1, 0), HUtil32.Str_ToInt(sParam2, 1));
                        return;
                    }
                    if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.HUNGER.sCmd).ToLower()) == 0)
                    {
                        CmdHunger(M2Share.g_GameCommand.HUNGER.sCmd, sParam1, HUtil32.Str_ToInt(sParam2, 0));
                        return;
                    }
                    if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.SETFLAG.sCmd).ToLower()) == 0)
                    {
                        PlayObject = UserEngine.GetPlayObject(sParam1);
                        if (PlayObject != null)
                        {
                            nFlag = HUtil32.Str_ToInt(sParam2, 0);
                            nValue = HUtil32.Str_ToInt(sParam3, 0);
                            PlayObject.SetQuestFlagStatus(nFlag, nValue);
                            if (PlayObject.GetQuestFalgStatus(nFlag) == 1)
                            {
                                this.SysMsg(PlayObject.m_sCharName + ": [" + (nFlag).ToString() + "] = ON", TMsgColor.c_Green, TMsgType.t_Hint);
                            }
                            else
                            {
                                this.SysMsg(PlayObject.m_sCharName + ": [" + (nFlag).ToString() + "] = OFF", TMsgColor.c_Green, TMsgType.t_Hint);
                            }
                        }
                        else
                        {
                            this.SysMsg("@" + M2Share.g_GameCommand.SETFLAG.sCmd + " 人物名称 标志号 数字(0 - 1)", TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                        return;
                    }
                    if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.RECONNECTION.sCmd).ToLower()) == 0)
                    {
                        CmdReconnection(sCmd, sParam1, sParam2);
                        return;
                    }
                    if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.DISABLEFILTER.sCmd).ToLower()) == 0)
                    {
                        CmdDisableFilter(sCmd, sParam1);
                        return;
                    }
                    if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.CHGUSERFULL.sCmd).ToLower()) == 0)
                    {
                        CmdChangeUserFull(sCmd, sParam1);
                        return;
                    }
                    if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.CHGZENFASTSTEP.sCmd).ToLower()) == 0)
                    {
                        CmdChangeZenFastStep(sCmd, sParam1);
                        return;
                    }
                    if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.CHANGEITEMNAME.sCmd).ToLower()) == 0)
                    {
                        CmdChangeItemName(M2Share.g_GameCommand.CHANGEITEMNAME.sCmd, sParam1, sParam2, sParam3);
                        return;
                    }
                    if ((this.m_btPermission >= 5) || (GameConfig.boTestServer))
                    {
                        if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.FIREBURN.sCmd).ToLower()) == 0)
                        {
                            //CmdFireBurn(HUtil32.Str_ToInt(sParam1, 0), HUtil32.Str_ToInt(sParam2, 0), HUtil32.Str_ToInt(sParam3, 0));
                            return;
                        }
                        if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.TESTFIRE.sCmd).ToLower()) == 0)
                        {
                            CmdTestFire(sCmd, HUtil32.Str_ToInt(sParam1, 0), HUtil32.Str_ToInt(sParam2, 0), HUtil32.Str_ToInt(sParam3, 0), HUtil32.Str_ToInt(sParam4, 0));
                            return;
                        }
                        if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.TESTSTATUS.sCmd).ToLower()) == 0)
                        {
                            CmdTestStatus(sCmd, HUtil32.Str_ToInt(sParam1, -1), HUtil32.Str_ToInt(sParam2, 0));
                            return;
                        }
                        if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.DELGAMEGOLD.sCmd).ToLower()) == 0)
                        {
                            CmdDelGameGold(M2Share.g_GameCommand.DELGAMEGOLD.sCmd, sParam1, HUtil32.Str_ToInt(sParam2, 0));
                            return;
                        }
                        if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.ADDGAMEGOLD.sCmd).ToLower()) == 0)
                        {
                            CmdAddGameGold(M2Share.g_GameCommand.ADDGAMEGOLD.sCmd, sParam1, HUtil32.Str_ToInt(sParam2, 0));
                            return;
                        }
                        if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.RELOADADMIN.sCmd).ToLower()) == 0)
                        {
                            CmdReLoadAdmin(M2Share.g_GameCommand.RELOADADMIN.sCmd);
                            return;
                        }
                        if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.ReLoadNpc.sCmd).ToLower()) == 0)
                        {
                            //CmdReloadNpc(sParam1);
                            return;
                        }
                        if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.RELOADMANAGE.sCmd).ToLower()) == 0)
                        {
                            CmdReloadManage(M2Share.g_GameCommand.RELOADMANAGE, sParam1);
                            return;
                        }
                        if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.RELOADROBOTMANAGE.sCmd).ToLower()) == 0)
                        {
                            CmdReloadRobotManage();
                            return;
                        }
                        if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.RELOADROBOT.sCmd).ToLower()) == 0)
                        {
                            CmdReloadRobot();
                            return;
                        }
                        if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.RELOADMONITEMS.sCmd).ToLower()) == 0)
                        {
                            CmdReloadMonItems();
                            return;
                        }
                        if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.RELOADITEMDB.sCmd).ToLower()) == 0)
                        {
                            LocalDB.GetInstance().LoadItemsDB();
                            this.SysMsg("物品数据库重新加载完成。", TMsgColor.c_Green, TMsgType.t_Hint);
                            return;
                        }
                        if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.RELOADMAGICDB.sCmd).ToLower()) == 0)
                        {
                            LocalDB.GetInstance().LoadMagicDB();
                            this.SysMsg("魔法数据库重新加载完成。", TMsgColor.c_Green, TMsgType.t_Hint);
                            return;
                        }
                        if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.RELOADMONSTERDB.sCmd).ToLower()) == 0)
                        {
                            LocalDB.GetInstance().LoadMonsterDB();
                            this.SysMsg("怪物数据库重新加载完成。", TMsgColor.c_Green, TMsgType.t_Hint);
                            return;
                        }
                        if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.RELOADMINMAP.sCmd).ToLower()) == 0)
                        {
                            LocalDB.GetInstance().LoadMinMap();
                            M2Share.g_MapManager.ReSetMinMap();
                            this.SysMsg("小地图配置重新加载完成。", TMsgColor.c_Green, TMsgType.t_Hint);
                            return;
                        }
                        if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.HEROLEVEL.sCmd).ToLower()) == 0)
                        {
                            CmdHeroLevel(M2Share.g_GameCommand.HEROLEVEL, sParam1, HUtil32.Str_ToInt(sParam2, 1));// 调整英雄等级
                            return;
                        }
                        if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.ADJUESTLEVEL.sCmd).ToLower()) == 0)
                        {
                            //CmdAdjuestLevel(M2Share.g_GameCommand.ADJUESTLEVEL, sParam1, HUtil32.Str_ToInt(sParam2, 1));// 调整人物等级
                            return;
                        }
                        if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.NGLEVEL.sCmd).ToLower()) == 0)
                        {
                            CmdNGLevel(M2Share.g_GameCommand.NGLEVEL, sParam1, HUtil32.Str_ToInt(sParam2, 1));  // 调整内功等级
                            return;
                        }
                        if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.ADJUESTEXP.sCmd).ToLower()) == 0)
                        {
                            CmdAdjuestExp(M2Share.g_GameCommand.ADJUESTEXP, sParam1, sParam2);
                            return;
                        }
                        if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.AddGuild.sCmd).ToLower()) == 0)
                        {
                            CmdAddGuild(M2Share.g_GameCommand.AddGuild, sParam1, sParam2);
                            return;
                        }
                        if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.DELGUILD.sCmd).ToLower()) == 0)
                        {
                            CmdDelGuild(M2Share.g_GameCommand.DELGUILD, sParam1);
                            return;
                        }
                        if (((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.CHANGESABUKLORD.sCmd).ToLower()) == 0))
                        {
                            CmdChangeSabukLord(M2Share.g_GameCommand.CHANGESABUKLORD, sParam1, sParam2, true);
                            return;
                        }
                        if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.FORCEDWALLCONQUESTWAR.sCmd).ToLower()) == 0)
                        {
                            CmdForcedWallconquestWar(M2Share.g_GameCommand.FORCEDWALLCONQUESTWAR, sParam1);
                            return;
                        }
                        if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.SPIRIT.sCmd).ToLower()) == 0)
                        {
                            CmdSpirtStart(M2Share.g_GameCommand.SPIRIT.sCmd, sParam1);
                            return;
                        }
                        else if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.SPIRITSTOP.sCmd).ToLower()) == 0)
                        {
                            CmdSpirtStop(M2Share.g_GameCommand.SPIRITSTOP.sCmd, sParam1);
                            return;
                        }
                        else if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.TESTSERVERCONFIG.sCmd).ToLower()) == 0)
                        {
                            SendServerConfig();
                            return;
                        }
                        else if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.SERVERSTATUS.sCmd).ToLower()) == 0)
                        {
                            SendServerStatus();
                            return;
                        }
                        else if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.TESTGETBAGITEM.sCmd).ToLower()) == 0)
                        {
                            CmdTestGetBagItems(M2Share.g_GameCommand.TESTGETBAGITEM, sParam1);
                            return;
                        }
                        else if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.MOBFIREBURN.sCmd).ToLower()) == 0)
                        {
                            CmdMobFireBurn(M2Share.g_GameCommand.MOBFIREBURN, sParam1, sParam2, sParam3, sParam4, sParam5, sParam6);
                            return;
                        }
                        else if ((sCmd).ToLower().CompareTo((M2Share.g_GameCommand.TESTSPEEDMODE.sCmd).ToLower()) == 0)
                        {
                            CmdTestSpeedMode(M2Share.g_GameCommand.TESTSPEEDMODE);
                            return;
                        }
                        else
                        {
                            CommandManager.ExecCmd(sData, this);
                        }
                    }
                }
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("@" + sCmd + " 此命令不正确，或没有足够的权限！！！", TMsgColor.c_Red, TMsgType.t_Hint);// GM命令错误是否提示
                }
            }
            catch
            {
                M2Share.MainOutMessage(string.Format(sExceptionMsg, sData));
            }
        }

        /// <summary>
        /// 处理角色发言数据
        /// </summary>
        /// <param name="sData"></param>
        public override void ProcessSayMsg(string sData)
        {
            bool boDisableSayMsg;
            string SC;
            string sCryCryMsg;
            string sParam1 = string.Empty;
            const string s01 = "{0} {1}";
            const string s02 = "{0} {1}({2}/{3})";
            const string sExceptionMsg = "{异常} TPlayObject.ProcessSayMsg Msg = {0}";
            if (this.m_btRaceServer != Grobal2.RC_PLAYOBJECT)
            {
                return;
            }
            try
            {
                if (sData == "")
                {
                    return;
                }
                if ((sData.Length > 1) && (sData[1] == '|'))
                {
                    SC = sData.Substring(2 - 1, sData.Length - 1);
                    if ((SC[1] == 'C') && (SC[3] == 'U') && (SC[5] == 'T'))
                    {
                        this.SysMsg(string.Format(s01, UserEngine.m_nLimitUserCount, UserEngine.m_nLimitNumber), TMsgColor.c_Red, TMsgType.t_Hint);// 注册人数
                        return;
                    }
                    if ((SC[1] == 'O') && (SC[6] == 'E') && (SC[11] == 'T'))
                    {
                        this.SysMsg(string.Format(s02, GameConfig.sServerName, UserEngine.PlayObjectCount,
                            UserEngine.PlayObjectCount - UserEngine.AutoAddExpPlayCount, UserEngine.AutoAddExpPlayCount),
                            TMsgColor.c_Red, TMsgType.t_Hint);// 服务器名,人数
                        return;
                    }
                    if ((SC[1] == 'S') && (SC[5] == 'T') && (SC[9] == 'E'))
                    {
                        this.SysMsg(M2Share.GetStartTime(M2Share.dwStartTime), TMsgColor.c_Red, TMsgType.t_Hint);// 运行时间
                        return;
                    }
                }
                if (sData.Length > GameConfig.nSayMsgMaxLen)
                {
                    sData = sData.Substring(1 - 1, GameConfig.nSayMsgMaxLen);
                }
                if (((HUtil32.GetTickCount() - m_dwSayMsgTick) < GameConfig.dwSayMsgTime))// 3 * 1000
                {
                    m_nSayMsgCount++;
                    if (m_nSayMsgCount >= GameConfig.nSayMsgCount)
                    {
                        m_boDisableSayMsg = true;
                        m_dwDisableSayMsgTick = HUtil32.GetTickCount() + GameConfig.dwDisableSayMsgTime;// 60 * 1000
                        // '[由于你重复发相同的内容，%d分钟内你将被禁止发言...]'
                        this.SysMsg(string.Format(GameMsgDef.g_sDisableSayMsg, GameConfig.dwDisableSayMsgTime / (60 * 1000)), TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                }
                else
                {
                    m_dwSayMsgTick = HUtil32.GetTickCount();
                    m_nSayMsgCount = 0;
                }
                if (HUtil32.GetTickCount() >= m_dwDisableSayMsgTick)
                {
                    m_boDisableSayMsg = false;
                }
                boDisableSayMsg = m_boDisableSayMsg;
                lock (M2Share.g_DenySayMsgList)
                    try
                    {
                        //if (M2Share.g_DenySayMsgList.GetIndex(this.m_sCharName) >= 0)
                        //{
                        //    boDisableSayMsg = true;
                        //}
                    }
                    finally
                    {
                        //M2Share.g_DenySayMsgList.UnLock();
                    }
                if (!boDisableSayMsg)
                {
                    if (sData[0] == '/')
                    {
                        SC = sData.Substring(2 - 1, sData.Length - 1);
                        if ((SC.Trim()).ToLower().CompareTo((M2Share.g_GameCommand.WHO.sCmd.Trim()).ToLower()) == 0)
                        {
                            if ((this.m_btPermission < M2Share.g_GameCommand.WHO.nPermissionMin))
                            {
                                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                                return;
                            }
                            //this.HearMsg(string.Format(GameMsgDef.g_sOnlineCountMsg, new int[] { UserEngine.PlayObjectCount, UserEngine.OnlinePlayObject, UserEngine.AutoAddExpPlayCount }));
                            return;
                        }
                        if ((SC.Trim()).ToLower().CompareTo((M2Share.g_GameCommand.TOTAL.sCmd.Trim()).ToLower()) == 0)
                        {
                            if ((this.m_btPermission < M2Share.g_GameCommand.TOTAL.nPermissionMin))
                            {
                                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                                return;
                            }
                            //this.HearMsg(string.Format(GameMsgDef.g_sTotalOnlineCountMsg, new int[] { GameMsgDef.g_nTotalHumCount }));
                            return;
                        }
                        SC = HUtil32.GetValidStr3(SC, ref sParam1, new string[] { " " });
                        if (!m_boFilterSendMsg)
                        {
                            Whisper(sParam1, SC);
                        }
                        return;
                    }
                    if (sData[0] == '!')
                    {
                        if (sData.Length >= 2)
                        {
                            if (sData[1] == '!')
                            {
                                SC = sData.Substring(3 - 1, sData.Length - 2);
                                SendGroupText(this.m_sCharName + ": " + SC);
                                return;
                            }
                            if (sData[1] == '~') // 行会聊天
                            {
                                if (this.m_MyGuild != null)
                                {
                                    SC = sData.Substring(3 - 1, sData.Length - 2);
                                    ((TGUild)(this.m_MyGuild)).SendGuildMsg(this.m_sCharName + ": " + SC);
                                    UserEngine.SendServerGroupMsg(Grobal2.SS_208, M2Share.nServerIndex, ((TGUild)(this.m_MyGuild)).sGuildName + '/' + this.m_sCharName + '/' + SC);
                                }
                                return;
                            }
                        }
                        if (!this.m_PEnvir.m_boQUIZ)
                        {
                            if ((HUtil32.GetTickCount() - m_dwShoutMsgTick) > 10000) // 10 * 1000
                            {
                                if (this.m_Abil.Level <= GameConfig.nCanShoutMsgLevel)
                                {
                                    this.SysMsg(string.Format(GameMsgDef.g_sYouNeedLevelMsg, GameConfig.nCanShoutMsgLevel + 1), TMsgColor.c_Red, TMsgType.t_Hint);
                                    return;
                                }
                                m_dwShoutMsgTick = HUtil32.GetTickCount();
                                SC = sData.Substring(2 - 1, sData.Length - 1);
                                sCryCryMsg = "(!)" + this.m_sCharName + ": " + SC;
                                if (m_boFilterSendMsg)
                                {
                                    this.SendMsg(null, Grobal2.RM_CRY, 0, 0, 0xFFFF, 0, sCryCryMsg);
                                }
                                else
                                {
                                    UserEngine.CryCry(Grobal2.RM_CRY, this.m_PEnvir, this.m_nCurrX, this.m_nCurrY, 50, GameConfig.btCryMsgFColor,
                                        GameConfig.btCryMsgBColor, sCryCryMsg);
                                }
                                return;
                            }
                            this.SysMsg(string.Format(GameMsgDef.g_sYouCanSendCyCyLaterMsg, 10 - (HUtil32.GetTickCount() - m_dwShoutMsgTick) / 1000), TMsgColor.c_Red, TMsgType.t_Hint);
                            return;
                        }
                        // '本地图不允许喊话！！！'
                        this.SysMsg(GameMsgDef.g_sThisMapDisableSendCyCyMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                        return;
                    }
                    if (m_boFilterSendMsg)
                    {
                        // 如果禁止发信息，则只向自己发信息
                        // g_Config.btHearMsgFColor
                        this.SendMsg(this, Grobal2.RM_HEAR, 0, m_btHearMsgFColor, GameConfig.btHearMsgBColor, 0, this.m_sCharName + ":" + sData);
                    }
                    else
                    {
                        this.SendRefMsg(Grobal2.RM_HEAR, 0, m_btHearMsgFColor, GameConfig.btHearMsgBColor, 0, this.m_sCharName + ":" + sData);
                    }
                    return;
                }
                // '禁止聊天'
                this.SysMsg(GameMsgDef.g_sYouIsDisableSendMsg, TMsgColor.c_Red, TMsgType.t_Hint);
            }
            catch
            {
                M2Share.MainOutMessage(string.Format(sExceptionMsg, sData));
            }
        }

        private unsafe bool ClientHitXY(int wIdent, int nX, int nY, int nDir, bool boLateDelivery, ref uint dwDelayTime)
        {
            bool result;
            int n14 = 0;
            int n18 = 0;
            TStdItem* StdItem;
            uint dwAttackTime = 0;
            uint dwCheckTime = 0;
            const string sExceptionMsg = "{异常} TPlayObject::ClientHitXY";
            result = false;
            dwDelayTime = 0;
            try
            {
                if (!m_boCanHit)
                {
                    return result;
                }
                if (this.m_boDeath || ((this.m_wStatusTimeArr[Grobal2.POISON_STONE] != 0) && !GameConfig.ClientConf.boParalyCanHit))
                {
                    return result;
                }
                // 防麻
                if (!boLateDelivery)
                {
                    if (!CheckActionStatus(wIdent, ref dwDelayTime))
                    {
                        m_boFilterAction = false;
                        return result;
                    }
                    m_boFilterAction = true;
                    dwAttackTime = (uint)HUtil32._MAX(0, ((int)GameConfig.dwHitIntervalTime) -
                        this.m_nHitSpeed * GameConfig.ClientConf.btItemSpeed);// 防止负数出错  武器速度控制
                    dwCheckTime = HUtil32.GetTickCount() - m_dwAttackTick;
                    if (dwCheckTime < dwAttackTime)
                    {
                        m_dwAttackCount++;
                        dwDelayTime = dwAttackTime - dwCheckTime;
                        if (dwDelayTime > GameConfig.dwDropOverSpeed)
                        {
                            if (m_dwAttackCount >= 4)
                            {
                                m_dwAttackTick = HUtil32.GetTickCount();
                                m_dwAttackCount = 0;
                                dwDelayTime = GameConfig.dwDropOverSpeed;
                                if (m_boTestSpeedMode)
                                {
                                    this.SysMsg("攻击忙复位！！！" + (dwDelayTime).ToString(), TMsgColor.c_Red, TMsgType.t_Hint);
                                }
                            }
                            else
                            {
                                m_dwAttackCount = 0;
                            }
                            return result;
                        }
                        else
                        {
                            if (m_boTestSpeedMode)
                            {
                                this.SysMsg("攻击步忙！！！" + (dwDelayTime).ToString(), TMsgColor.c_Red, TMsgType.t_Hint);
                            }
                            return result;
                        }
                    }
                }
                if ((nX == this.m_nCurrX) && (nY == this.m_nCurrY))
                {
                    result = true;
                    m_dwAttackTick = HUtil32.GetTickCount();
                    if ((wIdent == Grobal2.CM_HEAVYHIT) && (this.m_UseItems[TPosition.U_WEAPON]->Dura > 0))  // 挖矿
                    {
                        if (GameConfig.boStartMapEvent)// 开启地图解发
                        {
                            if (this.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                            {
                                StartMapEventOfMine();  // 挖矿事件触发
                            }
                        }
                        if (this.GetFrontPosition(ref n14, ref n18) && !this.m_PEnvir.CanWalk(n14, n18, false))
                        {
                            StdItem = UserEngine.GetStdItem(this.m_UseItems[TPosition.U_WEAPON]->wIndex);
                            if ((StdItem != null) && (StdItem->Shape == 19))
                            {
                                if (PileStones(n14, n18))
                                {
                                    SendSocket(null, "=DIG");
                                }
                                this.m_nHealthTick -= 30;
                                this.m_nSpellTick -= 50;
                                this.m_nSpellTick = HUtil32._MAX(0, this.m_nSpellTick);
                                this.m_nPerHealth -= 2;
                                this.m_nPerSpell -= 2;
                                return result;
                            }
                        }
                    }
                    if (wIdent == Grobal2.CM_HIT)
                    {
                        this.AttackDir(null, 0, nDir);
                    }
                    if (wIdent == Grobal2.CM_HEAVYHIT)
                    {
                        this.AttackDir(null, 1, nDir);
                    }
                    if (wIdent == Grobal2.CM_BIGHIT)
                    {
                        this.AttackDir(null, 2, nDir);
                    }
                    if ((wIdent == Grobal2.CM_POWERHIT) && (this.m_MagicPowerHitSkill != null))
                    {
                        this.AttackDir(null, 3, nDir);
                    }
                    // 攻杀
                    if ((wIdent == Grobal2.CM_LONGHIT) && (this.m_MagicErgumSkill != null))
                    {
                        this.AttackDir(null, 4, nDir);
                    }
                    if ((wIdent == Grobal2.CM_WIDEHIT) && (this.m_MagicBanwolSkill != null))
                    {
                        this.AttackDir(null, 5, nDir);
                    }
                    if ((wIdent == Grobal2.CM_FIREHIT) && (this.m_MagicFireSwordSkill != null))
                    {
                        this.AttackDir(null, 7, nDir);
                    }
                    // 普通烈火
                    if ((wIdent == Grobal2.CM_4FIREHIT) && (this.m_MagicFireSwordSkill != null))
                    {
                        this.AttackDir(null, 7, nDir);
                    }
                    // 4级烈火
                    if ((wIdent == Grobal2.CM_CRSHIT) && (this.m_MagicCrsSkill != null))
                    {
                        this.AttackDir(null, 8, nDir);
                    }
                    // 抱月
                    if ((wIdent == Grobal2.CM_TWNHIT) && (this.m_Magic42Skill != null))
                    {
                        this.AttackDir(null, 9, nDir);
                    }
                    // 开天斩重击
                    if ((wIdent == Grobal2.CM_QTWINHIT) && (this.m_Magic42Skill != null))
                    {
                        this.AttackDir(null, 9, nDir);
                    }
                    // 开天斩轻击
                    if ((wIdent == Grobal2.CM_CIDHIT) && (this.m_Magic43Skill != null))
                    {
                        this.AttackDir(null, 12, nDir);
                    }
                    // 龙影剑法
                    if ((wIdent == Grobal2.CM_SANJUEHIT) && (this.m_MagicSkill_76 != null))
                    {
                        this.AttackDir(null, 14, nDir);
                    }
                    // 三绝杀
                    if ((wIdent == Grobal2.CM_ZHUIXINHIT) && (this.m_MagicSkill_79 != null))
                    {
                        this.AttackDir(null, 15, nDir);
                    }
                    // 追心刺
                    if ((wIdent == Grobal2.CM_DUANYUEHIT) && (this.m_MagicSkill_82 != null))
                    {
                        this.AttackDir(null, 16, nDir);
                    }
                    // 断岳斩
                    if ((wIdent == Grobal2.CM_HENGSAOHIT) && (this.m_MagicSkill_85 != null))
                    {
                        this.AttackDir(null, 17, nDir);
                    }
                    // 横扫千军
                    if ((wIdent == Grobal2.CM_YTPDHIT) && (this.m_MagicSkill_69 != null))
                    {
                        this.AttackDir(null, 18, nDir);
                    }
                    // 倚天劈地
                    if ((wIdent == Grobal2.CM_XPYJHIT) && (this.m_MagicSkill_96 != null))
                    {
                        this.AttackDir(null, 21, nDir);
                    }
                    // 血魄一击 
                    if ((wIdent == Grobal2.CM_4LONGHIT) && (this.m_MagicSkill_89 != null))
                    {
                        this.AttackDir(null, 19, nDir);
                    }
                    // 四级刺杀
                    if ((wIdent == Grobal2.CM_YUANYUEHIT) && (this.m_MagicSkill_90 != null))
                    {
                        this.AttackDir(null, 20, nDir);
                    }
                    // 圆月弯刀
                    if (wIdent == Grobal2.CM_42HIT)
                    {
                        this.AttackDir(null, 10, nDir);
                    }
                    if (wIdent == Grobal2.CM_42HIT)
                    {
                        this.AttackDir(null, 11, nDir);
                    }
                    if ((wIdent == Grobal2.CM_DAILY) && (this.m_Magic74Skill != null))
                    {
                        this.AttackDir(null, 13, nDir);
                    }
                    // 逐日剑法
                    if (!this.m_boUseBatter)
                    {
                        // 连击不使用攻杀 
                        if ((this.m_MagicPowerHitSkill != null) && (this.m_UseItems[TPosition.U_WEAPON]->Dura > 0))
                        {
                            // 攻杀随机放出
                            this.m_btAttackSkillCount -= 1;
                            if (this.m_btAttackSkillPointCount == this.m_btAttackSkillCount)
                            {
                                this.m_boPowerHit = true;
                                SendSocket(null, "+PWR");
                            }
                            if (this.m_btAttackSkillCount <= 0)
                            {
                                this.m_btAttackSkillCount = Convert.ToByte(7 - this.m_MagicPowerHitSkill->btLevel);
                                this.m_btAttackSkillPointCount = (byte)HUtil32.Random(this.m_btAttackSkillCount);
                            }
                        }
                    }
                    this.m_nHealthTick -= 30;
                    this.m_nSpellTick -= 100;
                    this.m_nSpellTick = HUtil32._MAX(0, this.m_nSpellTick);
                    this.m_nPerHealth -= 2;
                    this.m_nPerSpell -= 2;
                }
            }
            catch
            {
                M2Share.MainOutMessage(sExceptionMsg);
            }
            return result;
        }

        /// <summary>
        /// 客户端骑马攻击
        /// </summary>
        /// <param name="wIdent"></param>
        /// <param name="nX"></param>
        /// <param name="nY"></param>
        /// <param name="boLateDelivery"></param>
        /// <param name="dwDelayTime"></param>
        /// <returns></returns>
        private bool ClientHorseRunXY(int wIdent, int nX, int nY, bool boLateDelivery, ref uint dwDelayTime)
        {
            bool result;
            int n14;
            uint dwCheckTime;
            result = false;
            dwDelayTime = 0;
            if (!m_boCanRun)
            {
                return result;
            }
            if (this.m_boDeath || ((this.m_wStatusTimeArr[Grobal2.POISON_STONE] != 0) && !GameConfig.ClientConf.boParalyCanRun))// 5
            {
                return result;
            }
            if (!boLateDelivery) // 防麻
            {
                if (!CheckActionStatus(wIdent, ref dwDelayTime))
                {
                    m_boFilterAction = false;
                    return result;
                }
                m_boFilterAction = true;
                dwCheckTime = HUtil32.GetTickCount() - m_dwMoveTick;
                if (dwCheckTime < GameConfig.dwRunIntervalTime)
                {
                    m_dwMoveCount++;
                    dwDelayTime = GameConfig.dwRunIntervalTime - dwCheckTime;
                    if (dwDelayTime > GameConfig.dwDropOverSpeed)
                    {
                        if (m_dwMoveCount >= 4)
                        {

                            m_dwMoveTick = HUtil32.GetTickCount();
                            m_dwMoveCount = 0;
                            dwDelayTime = GameConfig.dwDropOverSpeed;
                            if (m_boTestSpeedMode)
                            {
                                this.SysMsg("马跑步忙复位！！！" + (dwDelayTime).ToString(), TMsgColor.c_Red, TMsgType.t_Hint);
                            }
                        }
                        else
                        {
                            m_dwMoveCount = 0;
                        }
                        return result;
                    }
                    else
                    {
                        if (m_boTestSpeedMode)
                        {
                            this.SysMsg("马跑步忙！！！" + (dwDelayTime).ToString(), TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                        return result;
                    }
                }
            }

            m_dwMoveTick = HUtil32.GetTickCount();
            this.m_bo316 = false;
            this.SysMsg(string.Format("当前X:{0} 当前Y:{1} 目标X:{2} 目标Y:{3}", this.m_nCurrX, this.m_nCurrY, nX, nY), TMsgColor.c_Green, TMsgType.t_Hint);
            n14 = M2Share.GetNextDirection(this.m_nCurrX, this.m_nCurrY, nX, nY);
            if (HorseRunTo((byte)n14, false))
            {
                this.m_dwStationTick = HUtil32.GetTickCount();// 增加检测人物站立时间
                if (this.m_boTransparent && (this.m_boHideMode))// 0
                {
                    this.m_wStatusTimeArr[Grobal2.STATE_TRANSPARENT] = 1;
                }
                if (this.m_bo316 || ((this.m_nCurrX == nX) && (this.m_nCurrY == nY)))
                {
                    result = true;
                }
                this.m_nHealthTick -= 60;
                this.m_nSpellTick -= 10;
                this.m_nSpellTick = HUtil32._MAX(0, this.m_nSpellTick);
                this.m_nPerHealth -= 1;
                this.m_nPerSpell -= 1;
            }
            else
            {
                m_dwMoveCount = 0;
                m_dwMoveCountA = 0;
            }
            return result;
        }

        /// <summary>
        /// 客户端攻击目标
        /// </summary>
        /// <param name="wIdent"></param>
        /// <param name="nKey"></param>
        /// <param name="nTargetX">目标X</param>
        /// <param name="nTargetY">目标Y</param>
        /// <param name="TargeTBaseObject"></param>
        /// <param name="boLateDelivery"></param>
        /// <param name="dwDelayTime"></param>
        /// <returns></returns>
        private unsafe bool ClientSpellXY(ushort wIdent, int nKey, int nTargetX, int nTargetY, TBaseObject TargeTBaseObject, bool boLateDelivery, ref uint dwDelayTime)
        {
            bool result = false;
            TUserMagic* UserMagic;
            int nSpellPoint;
            TBaseObject BaseObject;
            uint dwCheckTime;
            bool boIsWarrSkill;
            const string sDisableMagicCross = "当前地图不允许使用：{0}";
            dwDelayTime = 0;
            this.m_nCurrBatterMagicID = 0;
            if (!(this.m_boUseBatter && (wIdent >= 76 && wIdent <= 87)))
            {
                if (!m_boCanSpell)// 不可以使用魔法，但可以使用连击技 
                {
                    return result;
                }
            }
            if (this.m_boDeath || ((this.m_wStatusTimeArr[Grobal2.POISON_STONE] != 0) && !GameConfig.ClientConf.boParalyCanSpell)) // 防麻
            {
                return result;
            }
            if (this.m_boUseBatter)// 连击使用wIdle获得魔法 
            {
                UserMagic = GetMagicInfo(wIdent);
            }
            else
            {
                UserMagic = GetMagicInfo(nKey);
            }
            if (UserMagic == null)
            {
                return result;
            }
            this.m_nCurrBatterMagicID = UserMagic->wMagIdx;
            if (this.m_PEnvir != null)
            {
                if (!this.m_PEnvir.AllowMagics(HUtil32.SBytePtrToString(UserMagic->MagicInfo.sMagicName, 0, UserMagic->MagicInfo.MagicNameLen)))
                {
                    this.SysMsg(string.Format(sDisableMagicCross, HUtil32.SBytePtrToString(UserMagic->MagicInfo.sMagicName, 0, UserMagic->MagicInfo.MagicNameLen)),
                        TMsgColor.c_Red, TMsgType.t_Notice);
                    return result;
                }
            }
            boIsWarrSkill = MagicManager.IsWarrSkill(UserMagic->wMagIdx);
            if (!boLateDelivery && !boIsWarrSkill)
            {
                if (!CheckActionStatus(wIdent, ref dwDelayTime))
                {
                    m_boFilterAction = false;
                    return result;
                }
                m_boFilterAction = true;
                dwCheckTime = HUtil32.GetTickCount() - m_dwMagicAttackTick;
                if (dwCheckTime < m_dwMagicAttackInterval)
                {
                    m_dwMagicAttackCount++;
                    dwDelayTime = m_dwMagicAttackInterval - dwCheckTime;
                    if (dwDelayTime > GameConfig.dwMagicHitIntervalTime / 3)
                    {
                        if (m_dwMagicAttackCount >= 4)
                        {
                            m_dwMagicAttackTick = HUtil32.GetTickCount();
                            m_dwMagicAttackCount = 0;
                            dwDelayTime = GameConfig.dwMagicHitIntervalTime / 3;
                            if (m_boTestSpeedMode)
                            {
                                this.SysMsg("魔法忙复位！！！" + dwDelayTime, TMsgColor.c_Red, TMsgType.t_Hint);
                            }
                        }
                        else
                        {
                            m_dwMagicAttackCount = 0;
                        }
                        return result;
                    }
                    else
                    {
                        if (m_boTestSpeedMode)
                        {
                            this.SysMsg("魔法忙！！！" + dwDelayTime, TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                        return result;
                    }
                }
            }
            this.m_nSpellTick -= 450;
            this.m_nSpellTick = HUtil32._MAX(0, this.m_nSpellTick);
            if (!boIsWarrSkill)
            {
                m_dwMagicAttackInterval = UserMagic->MagicInfo.dwDelayTime + GameConfig.dwMagicHitIntervalTime;
            }
            m_dwMagicAttackTick = HUtil32.GetTickCount();
            switch (UserMagic->wMagIdx)
            {
                case MagicConst.SKILL_ERGUM:// 12 刺杀剑法
                    if (this.m_MagicErgumSkill != null)
                    {
                        if (!this.m_boUseThrusting)
                        {
                            this.ThrustingOnOff(true);
                            SendSocket(null, "+LNG");
                        }
                        else
                        {
                            this.ThrustingOnOff(false);
                            SendSocket(null, "+ULNG");
                        }
                    }
                    result = true;
                    break;
                case MagicConst.SKILL_BANWOL:// 25 半月弯刀
                    if (this.m_MagicBanwolSkill != null)
                    {
                        if (!this.m_boUseHalfMoon)
                        {
                            this.HalfMoonOnOff(true);
                            SendSocket(null, "+WID");
                        }
                        else
                        {
                            this.HalfMoonOnOff(false);
                            SendSocket(null, "+UWID");
                        }
                    }
                    result = true;
                    break;
                case MagicConst.SKILL_90:// 90 圆月弯刀
                    if (this.m_MagicSkill_90 != null)
                    {
                        if (!this.m_bo90Kill)
                        {
                            this.YuanYueOnOff(true);
                            SendSocket(null, "+YUE");
                        }
                        else
                        {
                            this.YuanYueOnOff(false);
                            SendSocket(null, "+UYUE");
                        }
                    }
                    result = true;
                    break;
                case MagicConst.SKILL_FIRESWORD:// 26 烈火剑法  人物的技能
                    if (this.m_MagicFireSwordSkill != null)
                    {
                        if (this.AllowFireHitSkill())
                        {
                            nSpellPoint = GetSpellPoint(UserMagic);
                            if (this.m_WAbil.MP >= nSpellPoint)
                            {
                                if (nSpellPoint > 0)
                                {
                                    this.DamageSpell(nSpellPoint);
                                    this.HealthSpellChanged();
                                }
                                if (this.m_btRaceServer == Grobal2.RC_HEROOBJECT)
                                {
                                    //if ((this.m_MagicFireSwordSkill.btLevel == 4) && (((THeroObject)(this)).m_nLoyal >= GameConfig.nGotoLV4))
                                    //{
                                    //    SendSocket(null, "+4FIR");
                                    //}
                                    //else
                                    //{
                                    //    SendSocket(null, "+FIR");
                                    //}
                                }
                                else
                                {
                                    if ((this.m_MagicFireSwordSkill->btLevel == 4))
                                    {
                                        SendSocket(null, "+4FIR");
                                    }
                                    else
                                    {
                                        SendSocket(null, "+FIR");
                                    }
                                }
                            }
                        }
                    }
                    result = true;
                    break;
                case MagicConst.SKILL_74:// 逐日剑法
                    if (this.m_Magic74Skill != null)
                    {
                        if (this.AllowDailySkill())
                        {
                            nSpellPoint = GetSpellPoint(UserMagic);
                            if (this.m_WAbil.MP >= nSpellPoint)
                            {
                                if (nSpellPoint > 0)
                                {
                                    this.DamageSpell(nSpellPoint);
                                    this.HealthSpellChanged();
                                }
                                SendSocket(null, "+DAILY");
                            }
                        }
                    }
                    result = true;
                    break;
                case MagicConst.SKILL_MOOTEBO:// 野蛮冲撞
                    result = true;
                    if ((HUtil32.GetTickCount() - m_dwDoMotaeboTick) > 3000)  // 3 * 1000
                    {
                        m_dwDoMotaeboTick = HUtil32.GetTickCount();
                        this.m_btDirection = (byte)nTargetX;
                        nSpellPoint = GetSpellPoint(UserMagic);
                        if (this.m_WAbil.MP >= nSpellPoint)
                        {
                            if (nSpellPoint > 0)
                            {
                                this.DamageSpell(nSpellPoint);
                                this.HealthSpellChanged();
                            }
                            if (DoMotaebo(this.m_btDirection, UserMagic->btLevel))
                            {
                                if (UserMagic->btLevel < 3)
                                {
                                    if (UserMagic->MagicInfo.TrainLevel[UserMagic->btLevel] < this.m_Abil.Level)
                                    {
                                        this.TrainSkill(UserMagic, HUtil32.Random(3) + 1);
                                        if (!this.CheckMagicLevelup(UserMagic))
                                        {
                                            this.SendDelayMsg(this, Grobal2.RM_MAGIC_LVEXP, 0, UserMagic->MagicInfo.wMagicId, UserMagic->btLevel, UserMagic->nTranPoint, "", 1000);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    break;
                case MagicConst.SKILL_40:
                    // 抱月刀法
                    if (this.m_MagicCrsSkill != null)
                    {
                        if (!this.m_boCrsHitkill)
                        {
                            this.SkillCrsOnOff(true);
                            SendSocket(null, "+CRS");
                        }
                        else
                        {
                            this.SkillCrsOnOff(false);
                            SendSocket(null, "+UCRS");
                        }
                    }
                    result = true;
                    break;
                case 43:// 开天斩
                    if (this.m_Magic42Skill != null)
                    {
                        if (this.Skill42OnOff())
                        {
                            nSpellPoint = GetSpellPoint(UserMagic);
                            if (this.m_WAbil.MP >= nSpellPoint)
                            {
                                if (nSpellPoint > 0)
                                {
                                    this.DamageSpell(nSpellPoint);
                                    this.HealthSpellChanged();
                                }
                                if (HUtil32.Random(GameConfig.n43KillHitRate) == 0) // 增加 开天轻击
                                {
                                    this.m_n42kill = 2;
                                    SendSocket(null, "+TWN");
                                }
                                else
                                {
                                    this.m_n42kill = 1;
                                    SendSocket(null, "+QTWN");// 轻击
                                }
                            }
                        }
                    }
                    result = true;
                    break;
                case 42:// 龙影剑法(破空剑)
                    if (this.m_Magic43Skill != null)
                    {
                        if (this.Skill43OnOff())
                        {
                            nSpellPoint = GetSpellPoint(UserMagic);
                            if (this.m_WAbil.MP >= nSpellPoint)
                            {
                                if (nSpellPoint > 0)
                                {
                                    this.DamageSpell(nSpellPoint);
                                    this.HealthSpellChanged();
                                }
                                SendSocket(null, "+CID");
                            }
                        }
                    }
                    result = true;
                    break;
                case MagicConst.SKILL_76:
                    // 三绝杀
                    if (this.m_MagicSkill_76 != null)
                    {
                        SendSocket(null, "+SJUE");
                    }
                    break;
                case MagicConst.SKILL_79:
                    // 追心刺
                    if (this.m_MagicSkill_79 != null)
                    {
                        SendSocket(null, "+ZXIN");
                    }
                    break;
                case MagicConst.SKILL_82:
                    // 断岳斩
                    if (this.m_MagicSkill_82 != null)
                    {
                        SendSocket(null, "+DYUE");
                    }
                    break;
                case MagicConst.SKILL_85:
                    // 横扫千军
                    if (this.m_MagicSkill_85 != null)
                    {
                        SendSocket(null, "+HSAO");
                    }
                    break;
                case MagicConst.SKILL_69:
                    // 倚天劈地
                    if (this.m_MagicSkill_69 != null)
                    {
                        if (this.AllowYTPDHitSkill())
                        {
                            SendSocket(null, "+YTPD");
                        }
                    }
                    result = true;
                    break;
                case MagicConst.SKILL_96:
                    // 血魄一击
                    if (this.m_MagicSkill_96 != null)
                    {
                        if (this.AllowXPYJHitSkill())
                        {
                            SendSocket(null, "+XPYJ");
                        }
                    }
                    result = true;
                    break;
                default:
                    this.m_btDirection = M2Share.GetNextDirection(this.m_nCurrX, this.m_nCurrY, nTargetX, nTargetY);
                    BaseObject = null;
                    // 检查目标角色，与目标座标误差范围，如果在误差范围内则修正目标座标
                    // 修正目标坐标 就是耙子的目标 不是修改目标对象的位子
                    if (HUtil32.rangeInDefined(UserMagic->wMagIdx, 60, 65))
                    {
                        if (this.CretInNearXY(TargeTBaseObject, nTargetX, nTargetY, 12))
                        {
                            BaseObject = TargeTBaseObject;
                            nTargetX = BaseObject.m_nCurrX;
                            nTargetY = BaseObject.m_nCurrY;
                        }
                    }
                    else
                    {
                        if (this.CretInNearXY(TargeTBaseObject, nTargetX, nTargetY))
                        {
                            BaseObject = TargeTBaseObject;
                            nTargetX = BaseObject.m_nCurrX;
                            nTargetY = BaseObject.m_nCurrY;
                        }
                    }
                    if (!DoSpell(UserMagic, nTargetX, nTargetY, BaseObject))
                    {
                        this.SendRefMsg(Grobal2.RM_MAGICFIREFAIL, 0, 0, 0, 0, "");
                    }
                    result = true;
                    break;
            }
            if (result && this.m_boUseBatter)
            {
                if ((new ArrayList(new int[] { 77, 78, 80, 81, 83, 84, 86, 87 }).Contains(this.m_nCurrBatterMagicID)))
                {
                    this.m_boBatterFinally = true;
                }
            }
            return result;
        }

        private bool HorseRunTo(byte btDir, bool boFlag)
        {
            bool result = false;
            int n10;
            int n14;
            const string sExceptionMsg = "{异常} TPlayObject::HorseRunTo";
            try
            {
                n10 = this.m_nCurrX;
                n14 = this.m_nCurrY;
                this.m_btDirection = btDir;
                switch (btDir)
                {
                    case Grobal2.DR_UP:// 0
                        if ((this.m_nCurrY > 2) && (this.m_PEnvir.CanWalkEx(this.m_nCurrX, this.m_nCurrY - 1, GameConfig.boDiableHumanRun || ((this.m_btPermission > 9) && GameConfig.boGMRunAll)) || (GameConfig.boSafeAreaLimited && this.InSafeZone())) && (this.m_PEnvir.CanWalkEx(this.m_nCurrX, this.m_nCurrY - 2, GameConfig.boDiableHumanRun || ((this.m_btPermission > 9) && GameConfig.boGMRunAll)) || (GameConfig.boSafeAreaLimited && this.InSafeZone())) && (this.m_PEnvir.CanWalkEx(this.m_nCurrX, this.m_nCurrY - 3, GameConfig.boDiableHumanRun || ((this.m_btPermission > 9) && GameConfig.boGMRunAll)) || (GameConfig.boSafeAreaLimited && this.InSafeZone())) && (this.m_PEnvir.MoveToMovingObject(this.m_nCurrX, this.m_nCurrY, this, this.m_nCurrX, this.m_nCurrY - 3, true) > 0))
                        {
                            this.m_nCurrY -= 3;
                        }
                        break;
                    case Grobal2.DR_UPRIGHT:// 1
                        if ((this.m_nCurrX < this.m_PEnvir.m_nWidth - 3) && (this.m_nCurrY > 2) && (this.m_PEnvir.CanWalkEx(this.m_nCurrX + 1, this.m_nCurrY - 1, GameConfig.boDiableHumanRun || ((this.m_btPermission > 9) && GameConfig.boGMRunAll)) || (GameConfig.boSafeAreaLimited && this.InSafeZone())) && (this.m_PEnvir.CanWalkEx(this.m_nCurrX + 2, this.m_nCurrY - 2, GameConfig.boDiableHumanRun || ((this.m_btPermission > 9) && GameConfig.boGMRunAll)) || (GameConfig.boSafeAreaLimited && this.InSafeZone())) && (this.m_PEnvir.CanWalkEx(this.m_nCurrX + 3, this.m_nCurrY - 3, GameConfig.boDiableHumanRun || ((this.m_btPermission > 9) && GameConfig.boGMRunAll)) || (GameConfig.boSafeAreaLimited && this.InSafeZone())) && (this.m_PEnvir.MoveToMovingObject(this.m_nCurrX, this.m_nCurrY, this, this.m_nCurrX + 3, this.m_nCurrY - 3, true) > 0))
                        {
                            this.m_nCurrX += 3;
                            this.m_nCurrY -= 3;
                        }
                        break;
                    case Grobal2.DR_RIGHT:// 2
                        if ((this.m_nCurrX < this.m_PEnvir.m_nWidth - 3) && (this.m_PEnvir.CanWalkEx(this.m_nCurrX + 1, this.m_nCurrY, GameConfig.boDiableHumanRun || ((this.m_btPermission > 9) && GameConfig.boGMRunAll)) || (GameConfig.boSafeAreaLimited && this.InSafeZone())) && (this.m_PEnvir.CanWalkEx(this.m_nCurrX + 2, this.m_nCurrY, GameConfig.boDiableHumanRun || ((this.m_btPermission > 9) && GameConfig.boGMRunAll)) || (GameConfig.boSafeAreaLimited && this.InSafeZone())) && (this.m_PEnvir.CanWalkEx(this.m_nCurrX + 3, this.m_nCurrY, GameConfig.boDiableHumanRun || ((this.m_btPermission > 9) && GameConfig.boGMRunAll)) || (GameConfig.boSafeAreaLimited && this.InSafeZone())) && (this.m_PEnvir.MoveToMovingObject(this.m_nCurrX, this.m_nCurrY, this, this.m_nCurrX + 3, this.m_nCurrY, true) > 0))
                        {
                            this.m_nCurrX += 3;
                        }
                        break;
                    case Grobal2.DR_DOWNRIGHT:// 3
                        if ((this.m_nCurrX < this.m_PEnvir.m_nWidth - 3) && (this.m_nCurrY < this.m_PEnvir.m_nHeight - 3) && (this.m_PEnvir.CanWalkEx(this.m_nCurrX + 1, this.m_nCurrY + 1, GameConfig.boDiableHumanRun || ((this.m_btPermission > 9) && GameConfig.boGMRunAll)) || (GameConfig.boSafeAreaLimited && this.InSafeZone())) && (this.m_PEnvir.CanWalkEx(this.m_nCurrX + 2, this.m_nCurrY + 2, GameConfig.boDiableHumanRun || ((this.m_btPermission > 9) && GameConfig.boGMRunAll)) || (GameConfig.boSafeAreaLimited && this.InSafeZone())) && (this.m_PEnvir.CanWalkEx(this.m_nCurrX + 3, this.m_nCurrY + 3, GameConfig.boDiableHumanRun || ((this.m_btPermission > 9) && GameConfig.boGMRunAll)) || (GameConfig.boSafeAreaLimited && this.InSafeZone())) && (this.m_PEnvir.MoveToMovingObject(this.m_nCurrX, this.m_nCurrY, this, this.m_nCurrX + 3, this.m_nCurrY + 3, true) > 0))
                        {
                            this.m_nCurrX += 3;
                            this.m_nCurrY += 3;
                        }
                        break;
                    case Grobal2.DR_DOWN:// 4
                        if ((this.m_nCurrY < this.m_PEnvir.m_nHeight - 3) && (this.m_PEnvir.CanWalkEx(this.m_nCurrX, this.m_nCurrY + 1, GameConfig.boDiableHumanRun || ((this.m_btPermission > 9) && GameConfig.boGMRunAll)) || (GameConfig.boSafeAreaLimited && this.InSafeZone())) && (this.m_PEnvir.CanWalkEx(this.m_nCurrX, this.m_nCurrY + 2, GameConfig.boDiableHumanRun || ((this.m_btPermission > 9) && GameConfig.boGMRunAll)) || (GameConfig.boSafeAreaLimited && this.InSafeZone())) && (this.m_PEnvir.CanWalkEx(this.m_nCurrX, this.m_nCurrY + 3, GameConfig.boDiableHumanRun || ((this.m_btPermission > 9) && GameConfig.boGMRunAll)) || (GameConfig.boSafeAreaLimited && this.InSafeZone())) && (this.m_PEnvir.MoveToMovingObject(this.m_nCurrX, this.m_nCurrY, this, this.m_nCurrX, this.m_nCurrY + 3, true) > 0))
                        {
                            this.m_nCurrY += 3;
                        }
                        break;
                    case Grobal2.DR_DOWNLEFT:// 5
                        if ((this.m_nCurrX > 2) && (this.m_nCurrY < this.m_PEnvir.m_nHeight - 3) && (this.m_PEnvir.CanWalkEx(this.m_nCurrX - 1, this.m_nCurrY + 1, GameConfig.boDiableHumanRun || ((this.m_btPermission > 9) && GameConfig.boGMRunAll)) || (GameConfig.boSafeAreaLimited && this.InSafeZone())) && (this.m_PEnvir.CanWalkEx(this.m_nCurrX - 2, this.m_nCurrY + 2, GameConfig.boDiableHumanRun || ((this.m_btPermission > 9) && GameConfig.boGMRunAll)) || (GameConfig.boSafeAreaLimited && this.InSafeZone())) && (this.m_PEnvir.CanWalkEx(this.m_nCurrX - 3, this.m_nCurrY + 3, GameConfig.boDiableHumanRun || ((this.m_btPermission > 9) && GameConfig.boGMRunAll)) || (GameConfig.boSafeAreaLimited && this.InSafeZone())) && (this.m_PEnvir.MoveToMovingObject(this.m_nCurrX, this.m_nCurrY, this, this.m_nCurrX - 3, this.m_nCurrY + 3, true) > 0))
                        {
                            this.m_nCurrX -= 3;
                            this.m_nCurrY += 3;
                        }
                        break;
                    case Grobal2.DR_LEFT:// 6
                        if ((this.m_nCurrX > 2) && (this.m_PEnvir.CanWalkEx(this.m_nCurrX - 1, this.m_nCurrY, GameConfig.boDiableHumanRun || ((this.m_btPermission > 9) && GameConfig.boGMRunAll)) || (GameConfig.boSafeAreaLimited && this.InSafeZone())) && (this.m_PEnvir.CanWalkEx(this.m_nCurrX - 2, this.m_nCurrY, GameConfig.boDiableHumanRun || ((this.m_btPermission > 9) && GameConfig.boGMRunAll)) || (GameConfig.boSafeAreaLimited && this.InSafeZone())) && (this.m_PEnvir.CanWalkEx(this.m_nCurrX - 3, this.m_nCurrY, GameConfig.boDiableHumanRun || ((this.m_btPermission > 9) && GameConfig.boGMRunAll)) || (GameConfig.boSafeAreaLimited && this.InSafeZone())) && (this.m_PEnvir.MoveToMovingObject(this.m_nCurrX, this.m_nCurrY, this, this.m_nCurrX - 3, this.m_nCurrY, true) > 0))
                        {
                            this.m_nCurrX -= 3;
                        }
                        break;
                    case Grobal2.DR_UPLEFT:// 7
                        if ((this.m_nCurrX > 2) && (this.m_nCurrY > 2) && (this.m_PEnvir.CanWalkEx(this.m_nCurrX - 1, this.m_nCurrY - 1, GameConfig.boDiableHumanRun || ((this.m_btPermission > 9) && GameConfig.boGMRunAll)) || (GameConfig.boSafeAreaLimited && this.InSafeZone())) && (this.m_PEnvir.CanWalkEx(this.m_nCurrX - 2, this.m_nCurrY - 2, GameConfig.boDiableHumanRun || ((this.m_btPermission > 9) && GameConfig.boGMRunAll)) || (GameConfig.boSafeAreaLimited && this.InSafeZone())) && (this.m_PEnvir.CanWalkEx(this.m_nCurrX - 3, this.m_nCurrY - 3, GameConfig.boDiableHumanRun || ((this.m_btPermission > 9) && GameConfig.boGMRunAll)) || (GameConfig.boSafeAreaLimited && this.InSafeZone())) && (this.m_PEnvir.MoveToMovingObject(this.m_nCurrX, this.m_nCurrY, this, this.m_nCurrX - 3, this.m_nCurrY - 3, true) > 0))
                        {
                            this.m_nCurrX -= 3;
                            this.m_nCurrY -= 3;
                        }
                        break;
                }
                // SysMsg(format('原X:%d 原Y:%d 新X:%d 新Y:%d',[n10,n14,m_nCurrX,m_nCurrY]),c_Green,t_Hint);
                if ((this.m_nCurrX != n10) || (this.m_nCurrY != n14))
                {
                    if (this.Walk(Grobal2.RM_HORSERUN))
                    {
                        result = true;
                    }
                    else
                    {
                        this.m_nCurrX = n10;
                        this.m_nCurrY = n14;
                        this.m_PEnvir.MoveToMovingObject(n10, n14, this, this.m_nCurrX, this.m_nCurrX, true);
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage(sExceptionMsg);
            }
            return result;
        }

        private bool ClientRunXY(int wIdent, int nX, int nY, int nFlag, ref uint dwDelayTime)
        {
            bool result = false;
            int nDir;
            uint dwCheckTime;
            dwDelayTime = 0;
            if (!m_boCanRun)
            {
                return result;
            }
            if (this.m_boDeath || ((this.m_wStatusTimeArr[Grobal2.POISON_STONE] != 0) && !GameConfig.ClientConf.boParalyCanRun))
            {
                return result;
            }
            if (nFlag != wIdent)// 防麻
            {
                if (!CheckActionStatus(wIdent, ref dwDelayTime))
                {
                    m_boFilterAction = false;
                    return result;
                }
                m_boFilterAction = true;
                dwCheckTime = HUtil32.GetTickCount() - m_dwMoveTick;
                if (dwCheckTime < GameConfig.dwRunIntervalTime)
                {
                    m_dwMoveCount++;
                    dwDelayTime = GameConfig.dwRunIntervalTime - dwCheckTime;
                    if (dwDelayTime > GameConfig.dwRunIntervalTime / 3)
                    {
                        if (m_dwMoveCount >= 4)
                        {
                            m_dwMoveTick = HUtil32.GetTickCount();
                            m_dwMoveCount = 0;
                            dwDelayTime = GameConfig.dwRunIntervalTime / 3;
                            if (m_boTestSpeedMode)
                            {
                                this.SysMsg("跑步忙复位！！！" + (dwDelayTime).ToString(), TMsgColor.c_Red, TMsgType.t_Hint);
                            }
                        }
                        else
                        {
                            m_dwMoveCount = 0;
                        }
                        return result;
                    }
                    else
                    {
                        if (m_boTestSpeedMode)
                        {
                            this.SysMsg("跑步忙！！！" + (dwDelayTime).ToString(), TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                        return result;
                    }
                }
            }
            m_dwMoveTick = HUtil32.GetTickCount();
            this.m_bo316 = false;
            nDir = M2Share.GetNextDirection(this.m_nCurrX, this.m_nCurrY, nX, nY);
            if (this.RunTo((byte)nDir, false, nX, nY))
            {
                this.m_dwStationTick = HUtil32.GetTickCount();// 增加检测人物站立不动时间
                if (this.m_boTransparent && (this.m_boHideMode))
                {
                    this.m_wStatusTimeArr[Grobal2.STATE_TRANSPARENT] = 1;
                }
                if (this.m_bo316 || ((this.m_nCurrX == nX) && (this.m_nCurrY == nY)))
                {
                    result = true;
                }
                this.m_nHealthTick -= 60;// 原来跑步还得减少加血加魔的间隔
                this.m_nSpellTick -= 10;
                this.m_nSpellTick = HUtil32._MAX(0, this.m_nSpellTick);
                this.m_nPerHealth -= 1;// 加血的点数也给少了下去 不看代码真的不知道啊
                this.m_nPerSpell -= 1;
            }
            else
            {
                m_dwMoveCount = 0;
                m_dwMoveCountA = 0;
            }
            return result;
        }

        private bool ClientWalkXY(int wIdent, int nX, int nY, bool boLateDelivery, ref uint dwDelayTime)
        {
            bool result = false;
            int n14;
            uint dwCheckTime;
            dwDelayTime = 0;
            if (!m_boCanWalk)
            {
                return result;
            }
            if (this.m_boDeath || ((this.m_wStatusTimeArr[Grobal2.POISON_STONE] != 0) && !GameConfig.ClientConf.boParalyCanWalk))
            {
                return result;
            }
            // 防麻
            if (!boLateDelivery)
            {
                if (!CheckActionStatus(wIdent, ref dwDelayTime))
                {
                    m_boFilterAction = false;
                    return result;
                }
                m_boFilterAction = true;
                dwCheckTime = HUtil32.GetTickCount() - m_dwMoveTick;
                if (dwCheckTime < GameConfig.dwWalkIntervalTime)
                {
                    m_dwMoveCount++;
                    dwDelayTime = GameConfig.dwWalkIntervalTime - dwCheckTime;
                    if (dwDelayTime > GameConfig.dwWalkIntervalTime / 3)
                    {
                        if (m_dwMoveCount >= 4)
                        {
                            m_dwMoveTick = HUtil32.GetTickCount();
                            m_dwMoveCount = 0;
                            dwDelayTime = GameConfig.dwWalkIntervalTime / 3;
                            if (m_boTestSpeedMode)
                            {
                                this.SysMsg("走路忙复位！！！" + dwDelayTime, TMsgColor.c_Red, TMsgType.t_Hint);
                            }
                        }
                        else
                        {
                            m_dwMoveCount = 0;
                        }
                        return result;
                    }
                    else
                    {
                        if (m_boTestSpeedMode)
                        {
                            this.SysMsg("走路忙！！！" + dwDelayTime, TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                        return result;
                    }
                }
            }
            m_dwMoveTick = HUtil32.GetTickCount();
            this.m_bo316 = false;
            n14 = M2Share.GetNextDirection(this.m_nCurrX, this.m_nCurrY, nX, nY);
            if (!m_boClientFlag)
            {
                if ((n14 == 0) && (m_nStep == 0))
                {
                    m_nStep++;
                }
                else if ((n14 == 4) && (m_nStep == 1))
                {
                    m_nStep++;
                }
                else if ((n14 == 6) && (m_nStep == 2))
                {
                    m_nStep++;
                }
                else if ((n14 == 2) && (m_nStep == 3))
                {
                    m_nStep++;
                }
                else if ((n14 == 1) && (m_nStep == 4))
                {
                    m_nStep++;
                }
                else if ((n14 == 5) && (m_nStep == 5))
                {
                    m_nStep++;
                }
                else if ((n14 == 7) && (m_nStep == 6))
                {
                    m_nStep++;
                }
                else if ((n14 == 3) && (m_nStep == 7))
                {
                    m_nStep++;
                }
                else
                {
                    m_nStep = 0;
                }
            }
            if (this.WalkTo((byte)n14, false))
            {
                this.m_dwStationTick = HUtil32.GetTickCount();// 增加检测人物站立不动时间
                if (this.m_bo316 || ((this.m_nCurrX == nX) && (this.m_nCurrY == nY)))
                {
                    result = true;
                } this.m_nHealthTick -= 10;// 走路也少加血间隔
            }
            else
            {
                m_dwMoveCount = 0;
                m_dwMoveCountA = 0;
            }
            return result;
        }

        /// <summary>
        /// 玩家点击NPC
        /// </summary>
        /// <param name="NPC"></param>
        private void ClientClickNPC(int NPC)
        {
            TNormNpc NormNpc;
            if (!m_boCanDeal)
            {
                this.SendMsg(M2Share.g_ManageNPC, Grobal2.RM_MENU_OK, 0, this.ToInt(), 0, 0, GameMsgDef.g_sCanotTryDealMsg);
                return;
            }
            if (this.m_boDeath || this.m_boGhost)
            {
                return;
            }
            NormNpc = UserEngine.FindMerchant(NPC);
            if (NormNpc == null)
            {
                NormNpc = UserEngine.FindNPC(NPC);
            }
            if (NormNpc != null)
            {
                if ((NormNpc.m_PEnvir == this.m_PEnvir) && (Math.Abs(NormNpc.m_nCurrX - this.m_nCurrX) <= 15) && (Math.Abs(NormNpc.m_nCurrY - this.m_nCurrY) <= 15))
                {
                    NormNpc.Click(this);
                }
            }
        }

        /// <summary>
        /// 取范围内玩家数量
        /// </summary>
        /// <returns></returns>
        private int GetRangeHumanCount()
        {
            return UserEngine.GetMapOfRangeHumanCount(this.m_PEnvir, this.m_nCurrX, this.m_nCurrY, 10);
        }

        /// <summary>
        /// 取复活点
        /// </summary>
        private void GetStartPoint()
        {
            try
            {
                HUtil32.EnterCriticalSection(M2Share.g_StartPointList);
                if (this.PKLevel() >= 2) //红名玩家获取红名村地址配置
                {
                    this.m_sHomeMap = GameConfig.sRedHomeMap;
                    this.m_nHomeX = GameConfig.nRedHomeX;
                    this.m_nHomeY = GameConfig.nRedHomeY;
                }
                foreach (var StartPoint in M2Share.g_StartPointList)
                {
                    if (StartPoint.m_sMapName == this.m_PEnvir.sMapName)
                    {
                        if (StartPoint != null)
                        {
                            if ((Math.Abs(this.m_nCurrX - StartPoint.m_nCurrX) < 50) && (Math.Abs(this.m_nCurrY - StartPoint.m_nCurrY) < 50))
                            {
                                this.m_sHomeMap = StartPoint.m_sMapName;
                                this.m_nHomeX = StartPoint.m_nCurrX;
                                this.m_nHomeY = StartPoint.m_nCurrY;
                                break;
                            }
                        }
                    }
                }
            }
            finally
            {
                HUtil32.LeaveCriticalSection(M2Share.g_StartPointList);
            }
        }

        public void CmdAddGameGold(string sCmd, string sHumName, int nPoint)
        {
            TPlayObject PlayObject;
            if ((this.m_btPermission < 6))
            {
                return;
            }
            if ((sHumName == "") || (nPoint <= 0))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + sCmd + " 人物名称  数量", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumName);
            if (PlayObject != null)
            {
                if ((PlayObject.m_nGameGold + nPoint) < 2000000)
                {
                    PlayObject.m_nGameGold += nPoint;
                }
                else
                {
                    nPoint = 2000000 - PlayObject.m_nGameGold;
                    PlayObject.m_nGameGold = 2000000;
                }
                if (M2Share.g_boGameLogGameGold)
                {
                    M2Share.AddGameDataLog(string.Format(GameMsgDef.g_sGameLogMsg1, M2Share.LOG_GAMEGOLD, PlayObject.m_sMapName, PlayObject.m_nCurrX, PlayObject.m_nCurrY, PlayObject.m_sCharName, GameConfig.sGameGoldName, PlayObject.m_nGameGold, "命令+(" + (nPoint).ToString() + ")", this.m_sCharName));
                }
                PlayObject.GoldChanged();
                this.SysMsg(sHumName + "的游戏点已增加" + (nPoint).ToString() + ".", TMsgColor.c_Green, TMsgType.t_Hint);
                PlayObject.SysMsg("游戏点已增加" + (nPoint).ToString() + ".", TMsgColor.c_Green, TMsgType.t_Hint);
            }
            else
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, new string[] { sHumName }), TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        public void CmdDelGameGold(string sCmd, string sHumName, int nPoint)
        {
            TPlayObject PlayObject;
            if ((this.m_btPermission < 6))
            {
                return;
            }
            if ((sHumName == "") || (nPoint <= 0))
            {
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumName);
            if (PlayObject != null)
            {
                if (PlayObject.m_nGameGold > nPoint)
                {
                    PlayObject.m_nGameGold -= nPoint;
                }
                else
                {
                    nPoint = PlayObject.m_nGameGold;
                    PlayObject.m_nGameGold = 0;
                }
                if (M2Share.g_boGameLogGameGold)
                {
                    M2Share.AddGameDataLog(string.Format(GameMsgDef.g_sGameLogMsg1, M2Share.LOG_GAMEGOLD, PlayObject.m_sMapName, PlayObject.m_nCurrX, PlayObject.m_nCurrY, PlayObject.m_sCharName, GameConfig.sGameGoldName, PlayObject.m_nGameGold, "命令-(" + (nPoint).ToString() + ")", this.m_sCharName));
                }
                PlayObject.GoldChanged();
                this.SysMsg(sHumName + "的游戏点已减少" + (nPoint).ToString() + ".", TMsgColor.c_Green, TMsgType.t_Hint);
                PlayObject.SysMsg("游戏点已减少" + (nPoint).ToString() + ".", TMsgColor.c_Green, TMsgType.t_Hint);
            }
            else
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, new string[] { sHumName }), TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        //金刚石
        public void CmdGameDiaMond(TGameCmd Cmd, string sHumanName, string sCtr, int nGameDiaMond)
        {
            TPlayObject PlayObject;
            char Ctr;
            Ctr = '1';
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);// 权限不够
                return;
            }
            if ((sCtr != ""))
            {
                Ctr = sCtr[1];
            }
            if ((sHumanName == "") || !(new ArrayList(new string[] { "=", "+", "-" }).Contains(Ctr)) || (nGameDiaMond < 0) || (nGameDiaMond > 200000000) || ((sHumanName != "") && (sHumanName[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, Cmd.sCmd, GameMsgDef.g_sGameCommandGameDiaMondHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumanName);
            if (PlayObject == null)
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, sHumanName), TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            switch (sCtr[1])
            {
                case '=':
                    PlayObject.m_nGAMEDIAMOND = nGameDiaMond;
                    break;
                case '+':
                    PlayObject.m_nGAMEDIAMOND += nGameDiaMond;
                    break;
                case '-':
                    PlayObject.m_nGAMEDIAMOND -= nGameDiaMond;
                    break;
            }
            if (M2Share.g_boGameLogGameDiaMond)
            {
                M2Share.AddGameDataLog(string.Format(GameMsgDef.g_sGameLogMsg1, M2Share.LOG_GameDiaMond, PlayObject.m_sMapName,
                    PlayObject.m_nCurrX, PlayObject.m_nCurrY, PlayObject.m_sCharName, GameConfig.sGameDiaMond,
                    PlayObject.m_nGAMEDIAMOND, sCtr[1] + "(" + (nGameDiaMond).ToString() + ")", this.m_sCharName));
            }
            this.GameGoldChanged();
            PlayObject.SysMsg(string.Format(GameMsgDef.g_sGameCommandGameDiaMondHumanMsg, GameConfig.sGameDiaMond, nGameDiaMond, PlayObject.m_nGAMEDIAMOND, GameConfig.sGameDiaMond), TMsgColor.c_Green, TMsgType.t_Hint);
            this.SysMsg(string.Format(GameMsgDef.g_sGameCommandGameDiaMondGMMsg, sHumanName, GameConfig.sGameDiaMond, nGameDiaMond, PlayObject.m_nGAMEDIAMOND, GameConfig.sGameDiaMond), TMsgColor.c_Green, TMsgType.t_Hint);
        }

        // 灵符
        public void CmdGameGird(TGameCmd Cmd, string sHumanName, string sCtr, int nGameGird)
        {

        }

        // 灵符
        public void CmdGameGlory(TGameCmd Cmd, string sHumanName, string sCtr, byte nGameGlory)
        {
            TPlayObject PlayObject;
            char Ctr;
            Ctr = '1';
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);// 权限不够
                return;
            }
            if ((sCtr != ""))
            {
                Ctr = sCtr[0];
            }
            if ((sHumanName == "") || !(new ArrayList(new string[] { "=", "+", "-" }).Contains(Ctr)) || (nGameGlory < 0) || (nGameGlory > 255) || ((sHumanName != "") && (sHumanName[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, Cmd.sCmd, GameMsgDef.g_sGameCommandGameGloryHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumanName);
            if (PlayObject == null)
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, new string[] { sHumanName }), TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            switch (sCtr[0])
            {
                case '=':
                    PlayObject.m_btGameGlory = nGameGlory;
                    break;
                case '+':
                    PlayObject.m_btGameGlory += nGameGlory;
                    break;
                case '-':
                    PlayObject.m_btGameGlory -= nGameGlory;
                    break;
            }
            if (M2Share.g_boGameLogGameGlory)
            {
                M2Share.AddGameDataLog(string.Format(GameMsgDef.g_sGameLogMsg1, M2Share.LOG_GameGlory, PlayObject.m_sMapName, PlayObject.m_nCurrX, PlayObject.m_nCurrY, PlayObject.m_sCharName, GameConfig.sGameGlory, PlayObject.m_btGameGlory, sCtr[1] + "(" + (nGameGlory).ToString() + ")", this.m_sCharName));
            }
            this.GameGloryChanged();
            PlayObject.SysMsg(string.Format(GameMsgDef.g_sGameCommandGameGirdHumanMsg, GameConfig.sGameGlory, nGameGlory, PlayObject.m_btGameGlory, GameConfig.sGameGlory), TMsgColor.c_Green, TMsgType.t_Hint);
            this.SysMsg(string.Format(GameMsgDef.g_sGameCommandGameGirdGMMsg, sHumanName, GameConfig.sGameGlory, nGameGlory, PlayObject.m_btGameGlory, GameConfig.sGameGlory), TMsgColor.c_Green, TMsgType.t_Hint);
        }

        // 英雄的忠诚度
        public void CmdHeroLoyal(TGameCmd Cmd, string sHumanName, int nHeroLoyal)
        {
            TBaseObject PlayObject;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);// 权限不够
                return;
            }
            if ((sHumanName == "") || (nHeroLoyal < 0) || (nHeroLoyal > 10000) || ((sHumanName != "") && (sHumanName[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, Cmd.sCmd, GameMsgDef.g_sGameCommandHeroLoyalHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetHeroObject(sHumanName);
            if (PlayObject != null)
            {
                ((THeroObject)(PlayObject)).m_nLoyal = nHeroLoyal;
                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_HEROABILITY, ((THeroObject)(PlayObject)).m_btGender, 0, ((THeroObject)(PlayObject)).m_btJob, ((THeroObject)(PlayObject)).m_nLoyal, 0);
                //替换上面一句
                //SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(((THeroObject)(PlayObject)).m_WAbil, sizeof(TAbility)));
                this.SysMsg("[英雄忠诚度调整] " + sHumanName + " -> (" + (((THeroObject)(PlayObject)).m_nLoyal / 100).ToString() + "%)", TMsgColor.BB_Fuchsia, TMsgType.t_Hint);
                if (GameConfig.boShowMakeItemMsg)
                {
                    M2Share.MainOutMessage("[英雄忠诚度调整] " + sHumanName + " -> (" + (((THeroObject)(PlayObject)).m_nLoyal).ToString() + ")");
                }
            }
            else
            {
                this.SysMsg("英雄" + sHumanName + "现在不在线。", TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        // GM调整声望值
        public void CmdCreditPoint(TGameCmd Cmd, string sHumanName, string sCtr, int nPoint)
        {
            TPlayObject PlayObject;
            char Ctr;
            int nCreditPoint;
            Ctr = '1';
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sCtr != ""))
            {
                Ctr = sCtr[1];
            }
            if ((sHumanName == "") || !(new ArrayList(new string[] { "=", "+", "-" }).Contains(Ctr)) || (nPoint < 0) || (nPoint > Int32.MaxValue) || ((sHumanName != "") && (sHumanName[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, Cmd.sCmd, GameMsgDef.g_sGameCommandCreditPointHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumanName);
            if (PlayObject == null)
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, new string[] { sHumanName }), TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            switch (sCtr[1])
            {
                case '=':
                    PlayObject.m_btCreditPoint = (UInt16)nPoint;
                    break;
                case '+':
                    nCreditPoint = PlayObject.m_btCreditPoint + nPoint;
                    PlayObject.m_btCreditPoint = (UInt16)nCreditPoint;
                    break;
                case '-':
                    nCreditPoint = PlayObject.m_btCreditPoint - nPoint;
                    PlayObject.m_btCreditPoint = (UInt16)nCreditPoint;
                    break;
            }
            PlayObject.SysMsg(string.Format(GameMsgDef.g_sGameCommandCreditPointHumanMsg, new int[] { nPoint, PlayObject.m_btCreditPoint }), TMsgColor.c_Green, TMsgType.t_Hint);
            this.SysMsg(string.Format(GameMsgDef.g_sGameCommandCreditPointGMMsg, sHumanName, nPoint, PlayObject.m_btCreditPoint), TMsgColor.c_Green, TMsgType.t_Hint);
        }

        public void CmdAddGuild(TGameCmd Cmd, string sGuildName, string sGuildChief)
        {
            TPlayObject Human;
            bool boAddState;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (M2Share.nServerIndex != 0)
            {
                this.SysMsg("这个命令只能使用在主服务器上", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sGuildName == "") || (sGuildChief == ""))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " 行会名称 掌门人名称", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            boAddState = false;
            Human = UserEngine.GetPlayObject(sGuildChief);
            if (Human == null)
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, new string[] { sGuildChief }), TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (GuildManager.MemberOfGuild(sGuildChief) == null)
            {
                if (GuildManager.AddGuild(sGuildName, sGuildChief))
                {
                    UserEngine.SendServerGroupMsg(Grobal2.SS_205, M2Share.nServerIndex, sGuildName + "/" + sGuildChief);
                    this.SysMsg("行会名称: " + sGuildName + " 掌门人: " + sGuildChief, TMsgColor.c_Green, TMsgType.t_Hint);
                    boAddState = true;
                }
            }
            if (boAddState)
            {
                Human.m_MyGuild = GuildManager.MemberOfGuild(Human.m_sCharName);
                if (Human.m_MyGuild != null)
                {
                    Human.m_sGuildRankName = Human.m_MyGuild.GetRankName(this, ref Human.m_nGuildRankNo);
                    Human.RefShowName();
                }
            }
        }

        // 调整人物内功等级
        public void CmdAdjuestExp(TGameCmd Cmd, string sHumanName, string sExp)
        {
            TPlayObject PlayObject;
            uint dwExp;
            uint dwOExp;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sHumanName == ""))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " 人物名称 经验值", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            dwExp = (uint)HUtil32.Str_ToInt(sExp, 0);
            PlayObject = UserEngine.GetPlayObject(sHumanName);
            if (PlayObject != null)
            {
                dwOExp = PlayObject.m_Abil.Exp;
                PlayObject.m_Abil.Exp = dwExp;
                PlayObject.HasLevelUp(1);
                this.SysMsg(sHumanName + " 经验调整完成。", TMsgColor.c_Green, TMsgType.t_Hint);
                if (GameConfig.boShowMakeItemMsg)
                {
                    M2Share.MainOutMessage("[经验调整] " + this.m_sCharName + "(" + PlayObject.m_sCharName + " " + (dwOExp).ToString() + " -> " + (PlayObject.m_Abil.Exp).ToString() + ")");
                }
            }
            else
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, new string[] { sHumanName }), TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        // 千里传音
        public unsafe void CmdSysMsg(TGameCmd Cmd, string Text)
        {
            TStdItem* AmuletStdItem;
            TPlayObject PlayObject;
            if (Text == "")
            {
                this.SysMsg("命令格式: @" + Cmd.sCmd + " 发布信息", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            M2Share.IsFilterMsg(ref Text);// 文字过滤
            if (this.m_UseItems[TPosition.U_CHARM]->wIndex > 0)
            {
                AmuletStdItem = UserEngine.GetStdItem(this.m_UseItems[TPosition.U_CHARM]->wIndex);
                if ((AmuletStdItem != null) && (AmuletStdItem->StdMode == 7) && (AmuletStdItem->Shape == 0)) // 物品是千里传音
                {
                    if (this.m_UseItems[TPosition.U_CHARM]->Dura >= 1000)
                    {
                        this.m_UseItems[TPosition.U_CHARM]->Dura -= 1000;
                        this.SendMsg(this, Grobal2.RM_DURACHANGE, TPosition.U_CHARM, this.m_UseItems[TPosition.U_CHARM]->Dura, this.m_UseItems[TPosition.U_CHARM]->DuraMax, 0, "");// 减少持久数
                        try
                        {
                            //千里传音 的字的颜色
                            HUtil32.EnterCriticalSection(M2Share.ProcessHumanCriticalSection);
                            for (int I = 0; I < UserEngine.m_PlayObjectList.Count; I++)
                            {
                                PlayObject = UserEngine.m_PlayObjectList[I];
                                if (PlayObject != null)
                                {
                                    if (!PlayObject.m_boGhost)
                                    {
                                        PlayObject.SysMsg(this.m_sCharName + ":" + Text, TMsgColor.c_Fuchsia, TMsgType.t_Say);
                                    }
                                }
                            }
                        }
                        finally
                        {
                            HUtil32.LeaveCriticalSection(M2Share.ProcessHumanCriticalSection);
                        }
                        if (this.m_UseItems[TPosition.U_CHARM]->Dura <= 0)
                        {
                            SendDelItems(this.m_UseItems[TPosition.U_CHARM]);// 如果使用完，则删除物品
                            this.m_UseItems[TPosition.U_CHARM]->Dura = 0;
                            this.m_UseItems[TPosition.U_CHARM]->wIndex = 0;
                        }
                    }
                    else
                    {
                        SendDelItems(this.m_UseItems[TPosition.U_CHARM]); // 如果使用完，则删除物品
                        this.m_UseItems[TPosition.U_CHARM]->Dura = 0;
                        this.m_UseItems[TPosition.U_CHARM]->wIndex = 0;
                    }
                }
            }
            else
            {
                this.SysMsg("没有千里传音,或没有穿上装备栏里。", TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        // 调整英雄等级
        public void CmdHeroLevel(TGameCmd Cmd, string sHeroName, int nLevel)
        {
            TBaseObject PlayObject;
            int nOLevel;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);// 权限不够
                return;
            }
            if (sHeroName == "")
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " 英雄名称 等级", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetHeroObject(sHeroName);
            if (PlayObject != null)
            {
                nOLevel = PlayObject.m_Abil.Level;
                //PlayObject.m_Abil.Level = HUtil32._MAX(1, HUtil32._MIN(M2Share.MAXUPLEVEL, nLevel));
                PlayObject.HasLevelUp(1);
                // 等级调整记录日志
                M2Share.AddGameDataLog("17" + "\09" + PlayObject.m_sMapName + "\09" + (PlayObject.m_nCurrX).ToString() + "\09" + (PlayObject.m_nCurrY).ToString() + "\09"
                    + PlayObject.m_sCharName + "\09" + (PlayObject.m_Abil.Level).ToString() + "\09" + this.m_sCharName + "\09" + "+(" + (nLevel).ToString() + ")" + "\09" + "(英雄)");
                this.SysMsg("英雄 " + sHeroName + " 等级调整完成。", TMsgColor.BB_Fuchsia, TMsgType.t_Hint);
                if (GameConfig.boShowMakeItemMsg)
                {
                    M2Share.MainOutMessage("[英雄等级调整] " + sHeroName + "(" + (nOLevel).ToString() + " -> " + (PlayObject.m_Abil.Level).ToString() + ")");
                }
            }
            else
            {
                this.SysMsg("英雄" + sHeroName + "现在不在线。", TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        // 调整人物内功等级
        public void CmdNGLevel(TGameCmd Cmd, string sHumanName, int nLevel)
        {
            TPlayObject PlayObject;
            TBaseObject HeroObject;
            int nOLevel;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sHumanName == "") || (nLevel < 0) || (nLevel > 255))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " 人物名称 内功等级(1-255)", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumanName);
            if (PlayObject != null)
            {
                if (PlayObject.m_boTrainingNG)
                {
                    nOLevel = PlayObject.m_NGLevel;
                    PlayObject.m_NGLevel = (byte)HUtil32._MAX(1, HUtil32._MIN(255, nLevel));
                    PlayObject.SendNGData();// 发送内功数据
                    PlayObject.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTLEVELUP, 0, 0, 0, "");// 人物升级动画 
                    NGLevelUpFunc();// 内功升级触发
                    // 等级调整记录日志
                    M2Share.AddGameDataLog("17" + "\09" + PlayObject.m_sMapName + "\09" + (PlayObject.m_nCurrX).ToString() + "\09" +
                        (PlayObject.m_nCurrY).ToString() + "\09" + PlayObject.m_sCharName + "\09" + (PlayObject.m_NGLevel).ToString() + "\09" + "内功" + "\09" + "=("
                        + (nLevel).ToString() + ")" + "\09" + this.m_sCharName + "(GM)");
                    this.SysMsg(sHumanName + " 内功等级调整完成。", TMsgColor.c_Green, TMsgType.t_Hint);
                    if (GameConfig.boShowMakeItemMsg)
                    {
                        M2Share.MainOutMessage("[内功等级调整] " + this.m_sCharName + "(" + PlayObject.m_sCharName + " " + (nOLevel).ToString() + " -> " +
                            (PlayObject.m_NGLevel).ToString() + ")");
                    }
                }
                else
                {
                    this.SysMsg(PlayObject.m_sCharName + " 还未学习内功心法!!!", TMsgColor.c_Red, TMsgType.t_Hint);
                }
            }
            else
            {
                HeroObject = UserEngine.GetHeroObject(sHumanName);// 查找英雄
                if (HeroObject != null)
                {
                    if (((THeroObject)(HeroObject)).m_boTrainingNG)
                    {
                        nOLevel = ((THeroObject)(HeroObject)).m_NGLevel;
                        ((THeroObject)(HeroObject)).m_NGLevel = (byte)HUtil32._MAX(1, HUtil32._MIN(255, nLevel));
                        HeroObject.SendNGData();// 发送内功数据
                        HeroObject.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTLEVELUP, 0, 0, 0, "");// 人物升级动画 
                        ((THeroObject)(HeroObject)).NGLevelUpFunc();// 内功升级触发
                        // 等级调整记录日志
                        M2Share.AddGameDataLog("17" + "\09" + HeroObject.m_sMapName + "\09" + (HeroObject.m_nCurrX).ToString() + "\09" + (HeroObject.m_nCurrY).ToString()
                            + "\09" + HeroObject.m_sCharName + "\09" + (((THeroObject)(HeroObject)).m_NGLevel).ToString() + "\09" + "英雄内功" + "\09" + "=(" + (nLevel).ToString() + ")"
                            + "\09" + this.m_sCharName + "(GM)");
                        this.SysMsg(sHumanName + " 内功等级调整完成。", TMsgColor.c_Green, TMsgType.t_Hint);
                        if (GameConfig.boShowMakeItemMsg)
                        {
                            M2Share.MainOutMessage("[内功等级调整] " + this.m_sCharName + "(" + HeroObject.m_sCharName + " " + (nOLevel).ToString() + " -> "
                                + (((THeroObject)(HeroObject)).m_NGLevel).ToString() + ")");
                        }
                    }
                    else
                    {
                        this.SysMsg(HeroObject.m_sCharName + " 还未学习内功心法!!!", TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                }
                else
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, new string[] { sHumanName }), TMsgColor.c_Red, TMsgType.t_Hint);
                }
            }
        }

        public void CmdAdjustExp(TPlayObject Human, int nExp)
        {
            if ((this.m_btPermission < 6))
            {
                return;
            }
        }

        public void CmdBackStep(string sCmd, int nType, int nCount)
        {
            if ((this.m_btPermission < 6))
            {
                return;
            }
            nType = HUtil32._MIN(nType, 8);
            if (nType == 0)
            {
                this.CharPushed(this.GetBackDir(this.m_btDirection), nCount);
            }
            else
            {
                this.CharPushed((byte)HUtil32.Random(nType), nCount);
            }
        }

        // 调整身上装备附加属性 @SUPERMAKE
        public void CmdBonuPoint(TGameCmd Cmd, string sHumName, int nCount)
        {
            TPlayObject PlayObject;
            string sMsg;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sHumName == ""))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " 人物名称 属性点数(不输入为查看点数)", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumName);
            if (PlayObject == null)
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, new string[] { sHumName }), TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((nCount > 0))
            {
                PlayObject.m_nBonusPoint = nCount;
                PlayObject.SendMsg(this, Grobal2.RM_ADJUST_BONUS, 0, 0, 0, 0, "");
                return;
            }
            sMsg = string.Format("未分配点数:%d 已分配点数:(DC:%d MC:%d SC:%d AC:%d MAC:%d HP:%d MP:%d HIT:%d SPEED:%d)", PlayObject.m_nBonusPoint,
                PlayObject.m_BonusAbil.DC, PlayObject.m_BonusAbil.MC, PlayObject.m_BonusAbil.SC, PlayObject.m_BonusAbil.AC, PlayObject.m_BonusAbil.MAC,
                PlayObject.m_BonusAbil.HP, PlayObject.m_BonusAbil.MP, PlayObject.m_BonusAbil.Hit, PlayObject.m_BonusAbil.Speed);
            this.SysMsg(string.Format("%s的属性点数为:%s", new string[] { sHumName, sMsg }), TMsgColor.c_Red, TMsgType.t_Hint);
        }

        public void CmdChangeAdminMode(string sCmd, int nPermission, string sParam1, bool boFlag)
        {
            if ((this.m_btPermission < nPermission))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (((sParam1 != "") && (sParam1[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, sCmd, ""), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            this.m_boAdminMode = boFlag;
            if (this.m_boAdminMode)
            {
                this.SysMsg(GameMsgDef.sGameMasterMode, TMsgColor.c_Green, TMsgType.t_Hint);
            }
            else
            {
                this.SysMsg(GameMsgDef.sReleaseGameMasterMode, TMsgColor.c_Green, TMsgType.t_Hint);
            }
        }

        public void CmdChangeDearName(TGameCmd Cmd, string sHumanName, string sDearName)
        {
            TPlayObject PlayObject;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sHumanName == "") || (sDearName == ""))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " 人物名称 配偶名称(如果为 无 则清除)", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumanName);
            if (PlayObject != null)
            {
                if ((sDearName).ToLower().CompareTo(("无").ToLower()) == 0)
                {
                    PlayObject.m_sDearName = "";
                    PlayObject.RefShowName();
                    this.SysMsg(sHumanName + " 的配偶名清除成功。", TMsgColor.c_Green, TMsgType.t_Hint);
                }
                else
                {
                    PlayObject.m_sDearName = sDearName;
                    PlayObject.RefShowName();
                    this.SysMsg(sHumanName + " 的配偶名更改成功。", TMsgColor.c_Green, TMsgType.t_Hint);
                }
            }
            else
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, new string[] { sHumanName }), TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        // 改变物品名称
        public void CmdChangeItemName(string sCmd, string sMakeIndex, string sItemIndex, string sItemName)
        {
            int nMakeIndex;
            int nItemIndex;
            if ((this.m_btPermission < 6))
            {
                return;
            }
            if ((sMakeIndex == "") || (sItemIndex == "") || (sItemName == ""))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + sCmd + " 物品编号 物品ID号 物品名称", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            nMakeIndex = HUtil32.Str_ToInt(sMakeIndex, -1);
            nItemIndex = HUtil32.Str_ToInt(sItemIndex, -1);
            if ((nMakeIndex <= 0) || (nItemIndex < 0))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + sCmd + " 物品编号 物品ID号 物品名称", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            if (ItemUnit.AddCustomItemName(nMakeIndex, nItemIndex, sItemName))
            {
                ItemUnit.SaveCustomItemName();
                this.SysMsg("物品名称设置成功。", TMsgColor.c_Green, TMsgType.t_Hint);
                return;
            }
            this.SysMsg("此物品，已经设置了其它的名称！！！", TMsgColor.c_Red, TMsgType.t_Hint);
        }

        public void CmdChangeMasterName(TGameCmd Cmd, string sHumanName, string sMasterName, string sIsMaster)
        {
            TPlayObject PlayObject;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sHumanName == "") || (sMasterName == ""))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " 人物名称 师徒名称(如果为 无 则清除)", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumanName);
            if (PlayObject != null)
            {
                if ((sMasterName).ToLower().CompareTo(("无").ToLower()) == 0)
                {
                    PlayObject.m_sMasterName = "";
                    PlayObject.RefShowName();
                    PlayObject.m_boMaster = false;
                    this.SysMsg(sHumanName + " 的师徒名清除成功。", TMsgColor.c_Green, TMsgType.t_Hint);
                }
                else
                {
                    PlayObject.m_sMasterName = sMasterName;
                    if ((sIsMaster != "") && (sIsMaster[0] == '1'))
                    {
                        PlayObject.m_boMaster = true;
                    }
                    else
                    {
                        PlayObject.m_boMaster = false;
                    }
                    PlayObject.RefShowName();
                    this.SysMsg(sHumanName + " 的师徒名更改成功。", TMsgColor.c_Green, TMsgType.t_Hint);
                }
            }
            else
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, sHumanName), TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        public void CmdChangeObMode(string sCmd, int nPermission, string sParam1, bool boFlag)
        {
            if ((this.m_btPermission < nPermission))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (((sParam1 != "") && (sParam1[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, sCmd, ""), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            if (boFlag)
            {
                this.SendRefMsg(Grobal2.RM_DISAPPEAR, 0, 0, 0, 0, "");//强行发送刷新数据到客户端，解决GM登录隐身有影子问题
            }
            this.m_boObMode = boFlag;
            if (this.m_boObMode)
            {
                this.SysMsg(GameMsgDef.sObserverMode, TMsgColor.c_Green, TMsgType.t_Hint);
            }
            else
            {
                this.SysMsg(GameMsgDef.g_sReleaseObserverMode, TMsgColor.c_Green, TMsgType.t_Hint);
            }
        }

        public void CmdChangeSabukLord(TGameCmd Cmd, string sCASTLENAME, string sGuildName, bool boFlag)
        {
            TGUild Guild;
            TUserCastle Castle;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sCASTLENAME == "") || (sGuildName == ""))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " 城堡名称 行会名称", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            Castle = M2Share.g_CastleManager.Find(sCASTLENAME);
            if (Castle == null)
            {
                this.SysMsg(string.Format(GameMsgDef.g_sGameCommandSbkGoldCastleNotFoundMsg, sCASTLENAME), TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            Guild = GuildManager.FindGuild(sGuildName);
            if (Guild != null)
            {
                M2Share.AddGameDataLog("27" + "\09" + Castle.m_sOwnGuild + "\09" + "0" + "\09" + "1" + "\09" + "sGuildName" + "\09" + this.m_sCharName + "\09" + "0" + "\09" + "1" + "\09" + "0");
                Castle.GetCastle(Guild);
                if (boFlag)
                {
                    UserEngine.SendServerGroupMsg(Grobal2.SS_211, M2Share.nServerIndex, sGuildName);
                }
                this.SysMsg(Castle.m_sName + " 所属行会已经更改为 " + sGuildName, TMsgColor.c_Green, TMsgType.t_Hint);
            }
            else
            {
                this.SysMsg("行会 " + sGuildName + "还没建立！！！", TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        // 改变下属状态
        public void CmdChangeSalveStatus()
        {
            this.m_boSlaveRelax = !this.m_boSlaveRelax;
            if ((this.m_SlaveList.Count > 0) || ((m_MyHero != null) && (m_MyHero.m_SlaveList.Count > 0)))
            {
                if ((this.m_boSlaveRelax))
                {
                    this.SysMsg(GameMsgDef.sPetRest, TMsgColor.c_Green, TMsgType.t_Hint);
                }
                else
                {
                    this.SysMsg(GameMsgDef.sPetAttack, TMsgColor.c_Green, TMsgType.t_Hint);
                }
            }
            if ((m_MyHero != null) && (m_MyHero.m_SlaveList.Count > 0))
            {
                m_MyHero.m_boSlaveRelax = this.m_boSlaveRelax; //  主人控制英雄宝宝休息
            }
        }

        public void CmdChangeSuperManMode(string sCmd, int nPermission, string sParam1, bool boFlag)
        {
            if ((this.m_btPermission < nPermission))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (((sParam1 != "") && (sParam1[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, sCmd, ""), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            this.m_boSuperMan = boFlag;
            if (this.m_boSuperMan)
            {
                this.SysMsg(GameMsgDef.sSupermanMode, TMsgColor.c_Green, TMsgType.t_Hint);
            }
            else
            {
                this.SysMsg(GameMsgDef.sReleaseSupermanMode, TMsgColor.c_Green, TMsgType.t_Hint);
            }
        }

        // 设置服务器最高上线人数
        public void CmdChangeUserFull(string sCmd, string sUserCount)
        {
            int nCount;
            if ((this.m_btPermission < 6))
            {
                return;
            }
            nCount = HUtil32.Str_ToInt(sUserCount, -1);
            if ((sUserCount == "") || (nCount < 1) || ((sUserCount != "") && (sUserCount[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("设置服务器最高上线人数。", TMsgColor.c_Red, TMsgType.t_Hint);
                    this.SysMsg("命令格式: @" + sCmd + " 人数", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            GameConfig.nUserFull = nCount;

            this.SysMsg(string.Format("服务器上线人数限制: {0}", nCount), TMsgColor.c_Green, TMsgType.t_Hint);
        }

        public void CmdChangeZenFastStep(string sCmd, string sFastStep)
        {
            int nFastStep;
            if ((this.m_btPermission < 6))
            {
                return;
            }
            nFastStep = HUtil32.Str_ToInt(sFastStep, -1);
            if ((sFastStep == "") || (nFastStep < 1) || ((sFastStep != "") && (sFastStep[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("设置怪物行动速度。", TMsgColor.c_Red, TMsgType.t_Hint);
                    this.SysMsg("命令格式: @" + sCmd + " 速度", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            GameConfig.nZenFastStep = nFastStep;
            this.SysMsg(string.Format("怪物行动速度: {0}", nFastStep), TMsgColor.c_Green, TMsgType.t_Hint);
        }

        public unsafe void CmdShowUseItemInfo(TGameCmd Cmd, string sHumanName)
        {
            TPlayObject PlayObject;
            TUserItem* UserItem;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sHumanName == "") || ((sHumanName != "") && (sHumanName[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, Cmd.sCmd, GameMsgDef.g_sGameCommandShowUseItemInfoHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumanName);
            if (PlayObject == null)
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, sHumanName), TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            for (int I = PlayObject.m_UseItems.GetLowerBound(0); I <= PlayObject.m_UseItems.GetUpperBound(0); I++)
            {
                UserItem = PlayObject.m_UseItems[I];
                if (UserItem->wIndex == 0)
                {
                    continue;
                }
                this.SysMsg(string.Format("%s[%s]IDX[%d]系列号[%d]持久[%d-%d]", M2Share.GetUseItemName(I),
                    UserEngine.GetStdItemName(UserItem->wIndex), UserItem->wIndex, UserItem->MakeIndex, UserItem->Dura, UserItem->DuraMax), TMsgColor.c_Blue, TMsgType.t_Hint);
            }
        }

        public void CmdClearHumanPassword(string sCmd, int nPermission, string sHumanName)
        {
            TPlayObject PlayObject;
            if ((this.m_btPermission < nPermission))
            {
                return;
            }
            if ((sHumanName == "") || ((sHumanName != "") && (sHumanName[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("清除玩家的仓库密码！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                    this.SysMsg(string.Format("命令格式: @{0} 人物名称", sCmd), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumanName);
            if (PlayObject == null)
            {
                return;
            }
            PlayObject.m_boPasswordLocked = false;
            PlayObject.m_boUnLockStoragePwd = false;
            PlayObject.m_sStoragePwd = "";
            PlayObject.SysMsg("您的保护密码已被清除！！！", TMsgColor.c_Green, TMsgType.t_Hint);
            this.SysMsg(string.Format("%s的保护密码已被清除！！！", sHumanName), TMsgColor.c_Green, TMsgType.t_Hint);
        }

        public void CmdClearMission(TGameCmd Cmd, string sHumanName)
        {
            TPlayObject PlayObject;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sHumanName == ""))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " 人物名称)", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            if (sHumanName[0] == '?')
            {
                this.SysMsg("此命令用于清除人物的任务标志。", TMsgColor.c_Blue, TMsgType.t_Hint);
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumanName);
            if (PlayObject == null)
            {
                this.SysMsg(string.Format("%s不在线，或在其它服务器上！！", new string[] { sHumanName }), TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            this.SysMsg(string.Format("%s的任务标志已经全部清零。", new string[] { sHumanName }), TMsgColor.c_Green, TMsgType.t_Hint);
        }

        public void CmdContestPoint(TGameCmd Cmd, string sGuildName)
        {
            TGUild Guild;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sGuildName == "") || ((sGuildName != "") && (sGuildName[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("查看行会战的得分数。", TMsgColor.c_Red, TMsgType.t_Hint);
                    this.SysMsg(string.Format("命令格式: @{0} 行会名称", Cmd.sCmd), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            Guild = GuildManager.FindGuild(sGuildName);
            if (Guild != null)
            {
                this.SysMsg(string.Format("{0} 的得分为: {1]", sGuildName, Guild.nContestPoint), TMsgColor.c_Green, TMsgType.t_Hint);
            }
            else
            {
                this.SysMsg(string.Format("行会: {0} 不存在！！！", sGuildName), TMsgColor.c_Green, TMsgType.t_Hint);
            }
        }

        public void CmdStartContest(TGameCmd Cmd, string sParam1)
        {
            List<TPlayObject> List10;
            ArrayList List14;
            TPlayObject PlayObject;
            TPlayObject PlayObjectA;
            bool bo19;
            string s20;
            TGUild Guild;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (((sParam1 != "") && (sParam1[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("开始行会争霸赛。", TMsgColor.c_Red, TMsgType.t_Hint);

                    this.SysMsg(string.Format("命令格式: @{0}", Cmd.sCmd), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            if (!this.m_PEnvir.m_boFight3Zone)
            {
                this.SysMsg("此命令不能在当前地图中使用！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            List10 = new List<TPlayObject>();
            List14 = new ArrayList();
            UserEngine.GetMapRageHuman(this.m_PEnvir, this.m_nCurrX, this.m_nCurrY, 1000, List10);
            for (int I = 0; I < List10.Count; I++)
            {
                PlayObject = ((List10[I]) as TPlayObject);
                if (!PlayObject.m_boObMode || !PlayObject.m_boAdminMode)
                {
                    PlayObject.m_nFightZoneDieCount = 0;
                    if (PlayObject.m_MyGuild == null)
                    {
                        continue;
                    }
                    bo19 = false;
                    for (int II = 0; II < List14.Count; II++)
                    {
                        PlayObjectA = ((List14[II]) as TPlayObject);
                        if (PlayObject.m_MyGuild == PlayObjectA.m_MyGuild)
                        {
                            bo19 = true;
                        }
                    }
                    if (!bo19)
                    {
                        List14.Add(PlayObject.m_MyGuild);
                    }
                }
            }
            this.SysMsg("行会争霸赛已经开始。", TMsgColor.c_Green, TMsgType.t_Hint);
            UserEngine.CryCry(Grobal2.RM_CRY, this.m_PEnvir, this.m_nCurrX, this.m_nCurrY, 1000, GameConfig.btCryMsgFColor, GameConfig.btCryMsgBColor, "- 行会战争已爆发。");
            s20 = "";
            for (int I = 0; I < List14.Count; I++)
            {
                Guild = ((TGUild)(List14[I]));
                Guild.StartTeamFight();
                for (int II = 0; II < List10.Count; II++)
                {
                    PlayObject = ((List10[I]) as TPlayObject);
                    if (PlayObject.m_MyGuild == Guild)
                    {
                        Guild.AddTeamFightMember(PlayObject.m_sCharName);
                    }
                }
                s20 = s20 + Guild.sGuildName + " ";
            }
            UserEngine.CryCry(Grobal2.RM_CRY, this.m_PEnvir, this.m_nCurrX, this.m_nCurrY, 1000, GameConfig.btCryMsgFColor, GameConfig.btCryMsgBColor, " -参加的门派:" + s20);
            Dispose(List10);
            Dispose(List14);
        }

        public void CmdEndContest(TGameCmd Cmd, string sParam1)
        {
            List<TPlayObject> List10;
            ArrayList List14;
            TPlayObject PlayObject;
            TPlayObject PlayObjectA;
            bool bo19;
            TGUild Guild;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (((sParam1 != "") && (sParam1[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("结束行会争霸赛。", TMsgColor.c_Red, TMsgType.t_Hint);

                    this.SysMsg(string.Format("命令格式: @{0}", Cmd.sCmd), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            if (!this.m_PEnvir.m_boFight3Zone)
            {
                this.SysMsg("此命令不能在当前地图中使用！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            List10 = new List<TPlayObject>();
            List14 = new ArrayList();
            UserEngine.GetMapRageHuman(this.m_PEnvir, this.m_nCurrX, this.m_nCurrY, 1000, List10);
            for (int I = 0; I < List10.Count; I++)
            {
                PlayObject = ((List10[I]) as TPlayObject);
                if (!PlayObject.m_boObMode || !PlayObject.m_boAdminMode)
                {
                    if (PlayObject.m_MyGuild == null)
                    {
                        continue;
                    }
                    bo19 = false;
                    for (int II = 0; II < List14.Count; II++)
                    {
                        PlayObjectA = ((List14[II]) as TPlayObject);
                        if (PlayObject.m_MyGuild == PlayObjectA.m_MyGuild)
                        {
                            bo19 = true;
                        }
                    }
                    if (!bo19)
                    {
                        List14.Add(PlayObject.m_MyGuild);
                    }
                }
            }
            for (int I = 0; I < List14.Count; I++)
            {
                Guild = List14[I] as TGUild;
                Guild.EndTeamFight();
                UserEngine.CryCry(Grobal2.RM_CRY, this.m_PEnvir, this.m_nCurrX, this.m_nCurrY, 1000, GameConfig.btCryMsgFColor,
                    GameConfig.btCryMsgBColor, string.Format(" - {0} 行会争霸赛已结束。", Guild.sGuildName));
            }
            Dispose(List10);
            Dispose(List14);
        }

        public void CmdAnnouncement(TGameCmd Cmd, string sGuildName)
        {
            TGUild Guild;
            string sHumanName;
            int nPoint = 0;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sGuildName == "") || ((sGuildName != "") && (sGuildName[1] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("查看行会争霸赛结果。", TMsgColor.c_Red, TMsgType.t_Hint);

                    this.SysMsg(string.Format("命令格式: @%s 行会名称", new string[] { Cmd.sCmd }), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            if (!this.m_PEnvir.m_boFight3Zone)
            {
                this.SysMsg("此命令不能在当前地图中使用！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            Guild = GuildManager.FindGuild(sGuildName);
            if (Guild != null)
            {

                UserEngine.CryCry(Grobal2.RM_CRY, this.m_PEnvir, this.m_nCurrX, this.m_nCurrY, 1000, GameConfig.btCryMsgFColor, GameConfig.btCryMsgBColor, string.Format(" - %s 行会争霸赛结果: ", Guild.sGuildName));
                for (int I = 0; I < Guild.TeamFightDeadList.Count; I++)
                {
                    //nPoint = ((int)Guild.TeamFightDeadList[I]);
                    sHumanName = Guild.TeamFightDeadList[I];
                    UserEngine.CryCry(Grobal2.RM_CRY, this.m_PEnvir, this.m_nCurrX, this.m_nCurrY, 1000, GameConfig.btCryMsgFColor, GameConfig.btCryMsgBColor, string.Format(" - %s  : %d 分/死亡%d次。 ", sHumanName, HUtil32.HiWord(nPoint), HUtil32.LoWord(nPoint)));
                }
                // for
            }

            UserEngine.CryCry(Grobal2.RM_CRY, this.m_PEnvir, this.m_nCurrX, this.m_nCurrY, 1000, GameConfig.btCryMsgFColor, GameConfig.btCryMsgBColor, string.Format(" - [%s] : %d 分。", Guild.sGuildName, Guild.nContestPoint));
            UserEngine.CryCry(Grobal2.RM_CRY, this.m_PEnvir, this.m_nCurrX, this.m_nCurrY, 1000, GameConfig.btCryMsgFColor, GameConfig.btCryMsgBColor, "------------------------------------");
        }

        public void CmdDearRecall(string sCmd, string sParam)
        {
            if ((sParam != "") && (sParam[0] == '?'))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + sCmd + " (夫妻传送，将对方传送到自己身边，对方必须允许传送。)", TMsgColor.c_Green, TMsgType.t_Hint);
                }
                return;
            }
            if (m_sDearName == "")
            {
                this.SysMsg("您没有结婚！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (this.m_PEnvir.m_boNODEARRECALL)
            {
                this.SysMsg("本地图禁止夫妻传送！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (m_DearHuman == null)
            {
                if (this.m_btGender == 0)
                {
                    this.SysMsg("您的老婆不在线！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                else
                {
                    this.SysMsg("您的老公不在线！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }

            if (HUtil32.GetTickCount() - m_dwDearRecallTick < 10000)
            {
                this.SysMsg("稍等会才能再次使用此功能！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }

            m_dwDearRecallTick = HUtil32.GetTickCount();
            if (m_DearHuman.m_boCanDearRecall)
            {
                RecallHuman(m_DearHuman.m_sCharName);
            }
            else
            {
                this.SysMsg(m_DearHuman.m_sCharName + " 不允许传送！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
        }

        public void CmdMasterRecall(string sCmd, string sParam)
        {
            TPlayObject MasterHuman;
            if ((sParam != "") && (sParam[0] == '?'))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + sCmd + " (师徒传送，师父可以将徒弟传送到自己身边，徒弟必须允许传送。)", TMsgColor.c_Green, TMsgType.t_Hint);
                }
                return;
            }
            if (!m_boMaster)
            {
                this.SysMsg("只能师父才能使用此功能！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (m_MasterList.Count == 0)
            {
                this.SysMsg("您的徒弟一个都不在线！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (this.m_PEnvir.m_boNOMASTERRECALL)
            {
                this.SysMsg("本地图禁止师徒传送！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }

            if (HUtil32.GetTickCount() - m_dwMasterRecallTick < 10000)
            {
                this.SysMsg("稍等会才能再次使用此功能！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            for (int I = 0; I < m_MasterList.Count; I++)
            {
                MasterHuman = ((m_MasterList[I]) as TPlayObject);
                if (MasterHuman.m_boCanMasterRecall)
                {
                    RecallHuman(MasterHuman.m_sCharName);
                }
                else
                {
                    this.SysMsg(MasterHuman.m_sCharName + " 不允许传送！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                }
            }
        }

        public void CmdDelBonuPoint(TGameCmd Cmd, string sHumName)
        {
            TPlayObject PlayObject;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (sHumName == "")
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " 人物名称", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumName);
            if (PlayObject != null)
            {
                //FillChar(PlayObject.m_BonusAbil, sizeof(TNakedAbility), '\0');
                PlayObject.m_nBonusPoint = 0;
                PlayObject.SendMsg(PlayObject, Grobal2.RM_ADJUST_BONUS, 0, 0, 0, 0, "");
                PlayObject.HasLevelUp(0);
                PlayObject.SysMsg("分配点数已清除！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                this.SysMsg(sHumName + " 的分配点数已清除.", TMsgColor.c_Green, TMsgType.t_Hint);
            }
            else
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, new string[] { sHumName }), TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        // 清除地图怪物
        public void CmdReNewLevel(TGameCmd Cmd, string sHumanName, string sLevel)
        {
            TPlayObject PlayObject;
            int nLevel;
            if ((this.m_btPermission < 6))
            {
                return;
            }
            if ((sHumanName == "") || ((sHumanName != "") && (sHumanName[1] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " 人物名称 点数(为空则查看)", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            nLevel = HUtil32.Str_ToInt(sLevel, -1);
            PlayObject = UserEngine.GetPlayObject(sHumanName);
            if (PlayObject != null)
            {
                if ((nLevel >= 0) && (nLevel <= 255))
                {
                    PlayObject.m_btReLevel = (byte)nLevel;
                    PlayObject.RefShowName();
                }
                this.SysMsg(sHumanName + " 的转生等级为 " + (PlayObject.m_btReLevel).ToString(), TMsgColor.c_Green, TMsgType.t_Hint);
            }
            else
            {
                this.SysMsg(sHumanName + " 没在线上！！！", TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        public void CmdRestBonuPoint(TGameCmd Cmd, string sHumName)
        {
            TPlayObject PlayObject;
            int nTotleUsePoint;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (sHumName == "")
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " 人物名称", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumName);
            if (PlayObject != null)
            {
                nTotleUsePoint = PlayObject.m_BonusAbil.DC + PlayObject.m_BonusAbil.MC + PlayObject.m_BonusAbil.SC + PlayObject.m_BonusAbil.AC + PlayObject.m_BonusAbil.MAC + PlayObject.m_BonusAbil.HP + PlayObject.m_BonusAbil.MP + PlayObject.m_BonusAbil.Hit + PlayObject.m_BonusAbil.Speed + PlayObject.m_BonusAbil.X2;
                //FillChar(PlayObject.m_BonusAbil, sizeof(TNakedAbility), '\0');
                PlayObject.m_nBonusPoint += nTotleUsePoint;
                PlayObject.SendMsg(PlayObject, Grobal2.RM_ADJUST_BONUS, 0, 0, 0, 0, "");
                PlayObject.HasLevelUp(0);
                PlayObject.SysMsg("分配点数已复位！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                this.SysMsg(sHumName + " 的分配点数已复位.", TMsgColor.c_Green, TMsgType.t_Hint);
            }
            else
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, new string[] { sHumName }), TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        public void CmdSearchDear(string sCmd, string sParam)
        {
            if ((sParam != "") && (sParam[0] == '?'))
            {
                this.SysMsg("此命令用于查询配偶当前所在位置。", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (m_sDearName == "")
            {
                // '你都没结婚查什么？'
                this.SysMsg(GameMsgDef.g_sYouAreNotMarryedMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (m_DearHuman == null)
            {
                if (this.m_btGender == 0)
                {
                    // '你的老婆还没有上线！！！'
                    this.SysMsg(GameMsgDef.g_sYourWifeNotOnlineMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                }
                else
                {
                    // '你的老公还没有上线！！！'
                    this.SysMsg(GameMsgDef.g_sYourHusbandNotOnlineMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            if (this.m_btGender == 0)
            {
                // '你的老婆现在位于:'
                this.SysMsg(GameMsgDef.g_sYourWifeNowLocateMsg, TMsgColor.c_Green, TMsgType.t_Hint);
                this.SysMsg(m_DearHuman.m_sCharName + " " + m_DearHuman.m_PEnvir.sMapDesc + "(" + (m_DearHuman.m_nCurrX).ToString() + ":" + (m_DearHuman.m_nCurrY).ToString() + ")", TMsgColor.c_Green, TMsgType.t_Hint);
                // '你的老公正在找你，他现在位于:'
                m_DearHuman.SysMsg(GameMsgDef.g_sYourHusbandSearchLocateMsg, TMsgColor.c_Green, TMsgType.t_Hint);
                m_DearHuman.SysMsg(this.m_sCharName + " " + this.m_PEnvir.sMapDesc + "(" + (this.m_nCurrX).ToString() + ":" + (this.m_nCurrY).ToString() + ")", TMsgColor.c_Green, TMsgType.t_Hint);
            }
            else
            {
                // '你的老公现在位于:'
                this.SysMsg(GameMsgDef.g_sYourHusbandNowLocateMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                this.SysMsg(m_DearHuman.m_sCharName + " " + m_DearHuman.m_PEnvir.sMapDesc + "(" + (m_DearHuman.m_nCurrX).ToString() + ":" + (m_DearHuman.m_nCurrY).ToString() + ")", TMsgColor.c_Green, TMsgType.t_Hint);
                // '你的老婆正在找你，她现在位于:'
                m_DearHuman.SysMsg(GameMsgDef.g_sYourWifeSearchLocateMsg, TMsgColor.c_Green, TMsgType.t_Hint);
                m_DearHuman.SysMsg(this.m_sCharName + " " + this.m_PEnvir.sMapDesc + "(" + (this.m_nCurrX).ToString() + ":" + (this.m_nCurrY).ToString() + ")", TMsgColor.c_Green, TMsgType.t_Hint);
            }
        }

        public void CmdSetPermission(TGameCmd Cmd, string sHumanName, string sPermission)
        {
            int nPerission;
            TPlayObject PlayObject;
            const string sOutFormatMsg = "[权限调整] {0} ({1} {2} -> {2})";
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            nPerission = HUtil32.Str_ToInt(sPermission, 0);
            if ((sHumanName == "") || !(nPerission >= 0 && nPerission <= 10))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " 人物名称 权限等级(0 - 10)", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumanName);
            if (PlayObject == null)
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, new string[] { sHumanName }), TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (GameConfig.boShowMakeItemMsg)
            {
                M2Share.MainOutMessage(string.Format(sOutFormatMsg, this.m_sCharName, PlayObject.m_sCharName, PlayObject.m_btPermission, nPerission));
            }
            PlayObject.m_btPermission = (byte)nPerission;
            this.SysMsg(sHumanName + " 当前权限为: " + (PlayObject.m_btPermission).ToString(), TMsgColor.c_Red, TMsgType.t_Hint);
        }

        public void CmdShowHumanFlag(string sCmd, int nPermission, string sHumanName, string sFlag)
        {
            TPlayObject PlayObject;
            int nFlag;
            if ((this.m_btPermission < nPermission))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sHumanName == "") || ((sHumanName != "") && (sHumanName[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, sCmd, GameMsgDef.g_sGameCommandShowHumanFlagHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumanName);
            if (PlayObject == null)
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, sHumanName), TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            nFlag = HUtil32.Str_ToInt(sFlag, 0);
            if (PlayObject.GetQuestFalgStatus(nFlag) == 1)
            {
                this.SysMsg(string.Format(GameMsgDef.g_sGameCommandShowHumanFlagONMsg, PlayObject.m_sCharName, nFlag), TMsgColor.c_Green, TMsgType.t_Hint);
            }
            else
            {
                this.SysMsg(string.Format(GameMsgDef.g_sGameCommandShowHumanFlagOFFMsg, PlayObject.m_sCharName, nFlag), TMsgColor.c_Green, TMsgType.t_Hint);
            }
        }

        public void CmdShowMapInfo(TGameCmd Cmd, string sParam1)
        {
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (((sParam1 != "") && (sParam1[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, new string[] { Cmd.sCmd, "" }), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            this.SysMsg(string.Format(GameMsgDef.g_sGameCommandMapInfoMsg, this.m_PEnvir.sMapName, this.m_PEnvir.sMapDesc), TMsgColor.c_Green, TMsgType.t_Hint);
            this.SysMsg(string.Format(GameMsgDef.g_sGameCommandMapInfoSizeMsg, this.m_PEnvir.m_nWidth, this.m_PEnvir.m_nHeight), TMsgColor.c_Green, TMsgType.t_Hint);
        }

        public void CmdShowMapMode(string sCmd, string sMapName)
        {
            TEnvirnoment Envir;
            string sMsg;
            if ((this.m_btPermission < 6))
            {
                return;
            }
            if ((sMapName == ""))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + sCmd + " 地图号", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            Envir = M2Share.g_MapManager.FindMap(sMapName);
            if ((Envir == null))
            {
                this.SysMsg(sMapName + " 不存在！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            sMsg = "地图模式: " + Envir.GetEnvirInfo();
            this.SysMsg(sMsg, TMsgColor.c_Blue, TMsgType.t_Hint);
        }

        public void CmdSetMapMode(string sCmd, string sMapName, string sMapMode, string sParam1, string sParam2)
        {
            TEnvirnoment Envir;
            string sMsg;
            if ((this.m_btPermission < 6))
            {
                return;
            }
            if ((sMapName == "") || (sMapMode == ""))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + sCmd + " 地图号 模式", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            Envir = M2Share.g_MapManager.FindMap(sMapName);
            if ((Envir == null))
            {
                this.SysMsg(sMapName + " 不存在！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sMapMode).ToLower().CompareTo(("SAFE").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boSAFE = true;
                }
                else
                {
                    Envir.m_boSAFE = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("DARK").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boDARK = true;
                }
                else
                {
                    Envir.m_boDARK = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("DARK").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boDARK = true;
                }
                else
                {
                    Envir.m_boDARK = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("FIGHT").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boFightZone = true;
                }
                else
                {
                    Envir.m_boFightZone = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("FIGHT2").ToLower()) == 0) // PK掉装备地图
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boFight2Zone = true;
                }
                else
                {
                    Envir.m_boFight2Zone = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("FIGHT3").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boFight3Zone = true;
                }
                else
                {
                    Envir.m_boFight3Zone = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("FIGHT4").ToLower()) == 0)// 挑战地图
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boFight4Zone = true;
                }
                else
                {
                    Envir.m_boFight4Zone = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("DAY").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boDAY = true;
                }
                else
                {
                    Envir.m_boDAY = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("QUIZ").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boQUIZ = true;
                }
                else
                {
                    Envir.m_boQUIZ = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("NORECONNECT").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boNORECONNECT = true;
                    Envir.sNoReconnectMap = sParam1;
                }
                else
                {
                    Envir.m_boNORECONNECT = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("MUSIC").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boMUSIC = true;
                    Envir.m_nMUSICID = HUtil32.Str_ToInt(sParam1, -1);
                }
                else
                {
                    Envir.m_boMUSIC = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("EXPRATE").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boEXPRATE = true;
                    Envir.m_nEXPRATE = HUtil32.Str_ToInt(sParam1, -1);
                }
                else
                {
                    Envir.m_boEXPRATE = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("PKWINLEVEL").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boPKWINLEVEL = true;
                    Envir.m_nPKWINLEVEL = HUtil32.Str_ToInt(sParam1, -1);
                }
                else
                {
                    Envir.m_boPKWINLEVEL = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("PKWINEXP").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boPKWINEXP = true;
                    Envir.m_nPKWINEXP = (uint)HUtil32.Str_ToInt(sParam1, -1);
                }
                else
                {
                    Envir.m_boPKWINEXP = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("PKLOSTLEVEL").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boPKLOSTLEVEL = true;
                    Envir.m_nPKLOSTLEVEL = HUtil32.Str_ToInt(sParam1, -1);
                }
                else
                {
                    Envir.m_boPKLOSTLEVEL = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("PKLOSTEXP").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boPKLOSTEXP = true;
                    Envir.m_nPKLOSTEXP = (uint)HUtil32.Str_ToInt(sParam1, -1);
                }
                else
                {
                    Envir.m_boPKLOSTEXP = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("DECHP").ToLower()) == 0)
            {
                if ((sParam1 != "") && (sParam2 != ""))
                {
                    Envir.m_boDECHP = true;
                    Envir.m_nDECHPTIME = HUtil32.Str_ToInt(sParam1, -1);
                    Envir.m_nDECHPPOINT = HUtil32.Str_ToInt(sParam2, -1);
                }
                else
                {
                    Envir.m_boDECHP = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("DECGAMEGOLD").ToLower()) == 0)
            {
                if ((sParam1 != "") && (sParam2 != ""))
                {
                    Envir.m_boDecGameGold = true;
                    Envir.m_nDECGAMEGOLDTIME = HUtil32.Str_ToInt(sParam1, -1);
                    Envir.m_nDecGameGold = HUtil32.Str_ToInt(sParam2, -1);
                }
                else
                {
                    Envir.m_boDecGameGold = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("KILLFUNC").ToLower()) == 0)
            {
                // 20080415 地图杀人触发
                if ((sParam1 != ""))
                {
                    Envir.m_boKILLFUNC = true;
                    Envir.m_nKILLFUNC = HUtil32.Str_ToInt(sParam1, -1);
                }
                else
                {
                    Envir.m_boKILLFUNC = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("INCGAMEGOLD").ToLower()) == 0)
            {
                if ((sParam1 != "") && (sParam2 != ""))
                {
                    Envir.m_boIncGameGold = true;
                    Envir.m_nINCGAMEGOLDTIME = HUtil32.Str_ToInt(sParam1, -1);
                    Envir.m_nIncGameGold = HUtil32.Str_ToInt(sParam2, -1);
                }
                else
                {
                    Envir.m_boIncGameGold = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("INCGAMEPOINT").ToLower()) == 0)
            {
                if ((sParam1 != "") && (sParam2 != ""))
                {
                    Envir.m_boINCGAMEPOINT = true;
                    Envir.m_nINCGAMEPOINTTIME = HUtil32.Str_ToInt(sParam1, -1);
                    Envir.m_nINCGAMEPOINT = HUtil32.Str_ToInt(sParam2, -1);
                }
                else
                {
                    Envir.m_boINCGAMEPOINT = false;
                }
            }
            // ------------------------------------------------------------------------------
            else if ((sMapMode).ToLower().CompareTo(("NEEDLEVELTIME").ToLower()) == 0)
            {
                // 雪域地图传送,判断等级,地图时间 20081228
                if ((sParam1 != "") && (sParam2 != ""))
                {
                    Envir.m_boNEEDLEVELTIME = true;
                    Envir.m_nNEEDLEVELPOINT = HUtil32.Str_ToInt(sParam1, 0);
                    // 进地图最低等级
                }
                else
                {
                    Envir.m_boNEEDLEVELTIME = false;
                }
            }
            // 20080124 禁止召唤英雄
            else if ((sMapMode).ToLower().CompareTo(("NOCALLHERO").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boNOCALLHERO = true;
                }
                else
                {
                    Envir.m_boNOCALLHERO = false;
                }
            }
            // 禁止英雄守护 20080629
            else if ((sMapMode).ToLower().CompareTo(("NOHEROPROTECT").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boNOHEROPROTECT = true;
                }
                else
                {
                    Envir.m_boNOHEROPROTECT = false;
                }
            }
            // 20080503 禁止死亡掉物品
            else if ((sMapMode).ToLower().CompareTo(("NODROPITEM").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boNODROPITEM = true;
                }
                else
                {
                    Envir.m_boNODROPITEM = false;
                }
            }
            // 20080124 不允许使用任何物品和技能
            else if ((sMapMode).ToLower().CompareTo(("MISSION").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boMISSION = true;
                }
                else
                {
                    Envir.m_boMISSION = false;
                }
                // ------------------------------------------------------------------------------
            }
            else if ((sMapMode).ToLower().CompareTo(("RUNHUMAN").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boRUNHUMAN = true;
                }
                else
                {
                    Envir.m_boRUNHUMAN = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("RUNMON").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boRUNMON = true;
                }
                else
                {
                    Envir.m_boRUNMON = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("NEEDHOLE").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boNEEDHOLE = true;
                }
                else
                {
                    Envir.m_boNEEDHOLE = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("NORECALL").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boNORECALL = true;
                }
                else
                {
                    Envir.m_boNORECALL = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("NOGUILDRECALL").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boNOGUILDRECALL = true;
                }
                else
                {
                    Envir.m_boNOGUILDRECALL = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("NODEARRECALL").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boNODEARRECALL = true;
                }
                else
                {
                    Envir.m_boNODEARRECALL = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("NOMASTERRECALL").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boNOMASTERRECALL = true;
                }
                else
                {
                    Envir.m_boNOMASTERRECALL = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("NORANDOMMOVE").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boNORANDOMMOVE = true;
                }
                else
                {
                    Envir.m_boNORANDOMMOVE = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("NODRUG").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boNODRUG = true;
                }
                else
                {
                    Envir.m_boNODRUG = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("MINE").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boMINE = true;
                }
                else
                {
                    Envir.m_boMINE = false;
                }
            }
            else if ((sMapMode).ToLower().CompareTo(("NOPOSITIONMOVE").ToLower()) == 0)
            {
                if ((sParam1 != ""))
                {
                    Envir.m_boNOPOSITIONMOVE = true;
                }
                else
                {
                    Envir.m_boNOPOSITIONMOVE = false;
                }
            }
            sMsg = "地图模式: " + Envir.GetEnvirInfo();
            this.SysMsg(sMsg, TMsgColor.c_Blue, TMsgType.t_Hint);
        }

        public void CmdSignMapMove(TGameCmd Cmd)
        {
            TEnvirnoment Envir = null;
            try
            {
                if ((this.m_btPermission < Cmd.nPermissionMin))
                {
                    this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                    return;
                }
                if ((this.m_btPermission >= Cmd.nPermissionMax) || M2Share.CanMoveMap(m_sLastMapName))
                {
                    Envir = M2Share.g_MapManager.FindMap(m_sLastMapName);
                    if (Envir != null)
                    {
                        if (Envir.CanWalk(m_nLastCurrX, m_nLastCurrY, true))
                        {
                            this.SpaceMove(m_sLastMapName, m_nLastCurrX, m_nLastCurrY, 0);
                        }
                        else
                        {
                            this.SysMsg(string.Format(GameMsgDef.g_sGameCommandPositionMoveCanotMoveToMap1, m_sLastMapName, m_nLastCurrX, m_nLastCurrY), TMsgColor.c_Green, TMsgType.t_Hint);
                        }
                    }
                }
                else
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sTheMapDisableMove, m_sLastMapName, Envir.sMapDesc), TMsgColor.c_Red, TMsgType.t_Hint);
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.CmdPositionMove");
            }
        }

        // 清理指定玩家复制品
        public unsafe void CmdClearCopyItem(TGameCmd Cmd, string sName)
        {
            TPlayObject PlayObject;
            TUserItem* UserItem;
            TUserItem* UserItem1;
            string s14;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sName == ""))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " 人物名称", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sName);
            if (PlayObject == null)
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, new string[] { sName }), TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            for (int I = PlayObject.m_ItemList.Count - 1; I >= 0; I--)
            {
                if (PlayObject.m_ItemList.Count <= 0)
                {
                    break;
                }
                UserItem = (TUserItem*)PlayObject.m_ItemList[I];
                s14 = UserEngine.GetStdItemName(UserItem->wIndex);
                for (int II = I - 1; II >= 0; II--)
                {
                    UserItem1 = (TUserItem*)PlayObject.m_ItemList[II];
                    if ((UserEngine.GetStdItemName(UserItem1->wIndex) == s14) && (UserItem->MakeIndex == UserItem1->MakeIndex))
                    {
                        this.m_ItemList.RemoveAt(II);
                        break;
                    }
                }
            }
            for (int I = PlayObject.m_StorageItemList.Count - 1; I >= 0; I--)
            {
                if (PlayObject.m_StorageItemList.Count <= 0)
                {
                    break;
                }
                UserItem = (TUserItem*)PlayObject.m_StorageItemList[I];
                s14 = UserEngine.GetStdItemName(UserItem->wIndex);
                for (int II = I - 1; II >= 0; II--)
                {
                    UserItem1 = (TUserItem*)PlayObject.m_StorageItemList[II];
                    if ((UserEngine.GetStdItemName(UserItem1->wIndex) == s14) && (UserItem->MakeIndex == UserItem1->MakeIndex))
                    {
                        m_StorageItemList.RemoveAt(II);
                        break;
                    }
                }
            }
        }

        // 取玩家物品(背包,仓库)
        public unsafe void CmdGetUserItems(TGameCmd Cmd, string sHumanName, string sItemName, string sItemCount, string sType)
        {
            TPlayObject PlayObject;
            int nItemCount;
            int nCount;
            int nType;
            TStdItem* StdItem;
            TUserItem* UserItem;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sHumanName == "") || (sItemName == "") || (sItemCount == "") || (sType == ""))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " 人物名称 物品名称 数量 类型(0,1,2)", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumanName);
            if (PlayObject == null)
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, new string[] { sHumanName }), TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            nCount = HUtil32.Str_ToInt(sItemCount, 0);
            nType = HUtil32.Str_ToInt(sType, 0);
            switch (nType)
            {
                case 0:
                    nItemCount = 0;
                    for (int I = PlayObject.m_UseItems.GetLowerBound(0); I <= PlayObject.m_UseItems.GetUpperBound(0); I++)
                    {
                        UserItem = PlayObject.m_UseItems[I];
                        StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                        if ((StdItem != null) && ((sItemName).ToLower().CompareTo((HUtil32.SBytePtrToString(StdItem->Name, StdItem->NameLen)).ToLower()) == 0))
                        {
                            UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                            UserItem = PlayObject.m_UseItems[I];
                            this.m_ItemList.Add((IntPtr)UserItem);
                            SendAddItem(UserItem);
                            PlayObject.m_UseItems[I]->wIndex = 0;
                            nItemCount++;
                            if (this.m_ItemList.Count >= 46)
                            {
                                break;
                            }
                            if (nItemCount >= nCount)
                            {
                                break;
                            }
                        }
                    }
                    PlayObject.SendUseitems();
                    break;
                case 1:
                    nItemCount = 0;
                    for (int I = PlayObject.m_ItemList.Count - 1; I >= 0; I--)
                    {
                        if (PlayObject.m_ItemList.Count <= 0)
                        {
                            break;
                        }
                        UserItem = (TUserItem*)PlayObject.m_ItemList[I];
                        StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                        if ((StdItem != null) && ((sItemName).ToLower().CompareTo((HUtil32.SBytePtrToString(StdItem->Name, StdItem->NameLen)).ToLower()) == 0))
                        {
                            PlayObject.SendDelItems(UserItem);
                            PlayObject.m_ItemList.RemoveAt(I);
                            this.m_ItemList.Add((IntPtr)UserItem);
                            SendAddItem(UserItem);
                            nItemCount++;
                            if (this.m_ItemList.Count >= 46)
                            {
                                break;
                            }
                            if (nItemCount >= nCount)
                            {
                                break;
                            }
                        }
                    }
                    break;
                case 2:
                    nItemCount = 0;
                    for (int I = PlayObject.m_StorageItemList.Count - 1; I >= 0; I--)
                    {
                        if (PlayObject.m_StorageItemList.Count <= 0)
                        {
                            break;
                        }
                        UserItem = (TUserItem*)PlayObject.m_StorageItemList[I];
                        StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                        if ((StdItem != null) && ((sItemName).ToLower().CompareTo((HUtil32.SBytePtrToString(StdItem->Name, StdItem->NameLen)).ToLower()) == 0))
                        {
                            PlayObject.m_StorageItemList.RemoveAt(I);
                            this.m_ItemList.Add((IntPtr)UserItem);
                            SendAddItem(UserItem);
                            nItemCount++;
                            if (this.m_ItemList.Count >= 46)
                            {
                                break;
                            }
                            if (nItemCount >= nCount)
                            {
                                break;
                            }
                        }
                    }
                    break;
            }
        }

        public unsafe void CmdDeleteItem(TGameCmd Cmd, string sHumanName, string sItemName, int nCount)
        {
            TPlayObject PlayObject;
            int nItemCount;
            TStdItem* StdItem;
            TUserItem* UserItem;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sHumanName == "") || (sItemName == ""))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " 人物名称 物品名称 数量)", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumanName);
            if (PlayObject == null)
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, new string[] { sHumanName }), TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            nItemCount = 0;
            for (int I = PlayObject.m_ItemList.Count - 1; I >= 0; I--)
            {
                if (PlayObject.m_ItemList.Count <= 0)
                {
                    break;
                }
                UserItem = (TUserItem*)PlayObject.m_ItemList[I];
                if (UserItem == null)
                {
                    continue;
                }
                StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                if ((StdItem != null) && ((sItemName).ToLower().CompareTo((HUtil32.SBytePtrToString(StdItem->Name, 0, StdItem->NameLen)).ToLower()) == 0))
                {
                    PlayObject.SendDelItems(UserItem);
                    Marshal.FreeHGlobal((IntPtr)UserItem);
                    PlayObject.m_ItemList.RemoveAt(I);
                    nItemCount++;
                    if (nItemCount >= nCount)
                    {
                        break;
                    }
                }
            }
        }

        public void CmdDelGuild(TGameCmd Cmd, string sGuildName)
        {
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (M2Share.nServerIndex != 0)
            {
                this.SysMsg("只能在主服务器上才可以使用此命令删除行会！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (sGuildName == "")
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " 行会名称", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            if (GuildManager.DelGuild(sGuildName))
            {
                UserEngine.SendServerGroupMsg(Grobal2.SS_206, M2Share.nServerIndex, sGuildName);
            }
            else
            {
                this.SysMsg("没找到" + sGuildName + "这个行会！！！", TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        public void CmdDenyAccountLogon(TGameCmd Cmd, string sAccount, string sFixDeny)
        {
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (sAccount == "")
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " 登录帐号 是否永久封(0,1)", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            //M2Share.g_DenyAccountList.__Lock();
            try
            {
                if ((sFixDeny != "") && (sFixDeny[0] == '1'))
                {
                    //M2Share.g_DenyAccountList.Add(sAccount, ((1) as Object));
                    M2Share.SaveDenyAccountList();
                    this.SysMsg(sAccount + "已加入禁止登录帐号列表", TMsgColor.c_Green, TMsgType.t_Hint);
                }
                else
                {
                    //M2Share.g_DenyAccountList.Add(sAccount, ((0) as Object));
                    this.SysMsg(sAccount + "已加入临时禁止登录帐号列表", TMsgColor.c_Green, TMsgType.t_Hint);
                }
            }
            finally
            {
                //M2Share.g_DenyAccountList.UnLock();
            }
        }

        public void CmdDenyCharNameLogon(TGameCmd Cmd, string sCharName, string sFixDeny)
        {
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (sCharName == "")
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " 人物名称 是否永久封(0,1)", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            M2Share.g_DenyChrNameList.__Lock();
            try
            {
                if ((sFixDeny != "") && (sFixDeny[0] == '1'))
                {
                    //M2Share.g_DenyChrNameList.Add(sCharName, ((1) as Object));
                    M2Share.SaveDenyChrNameList();
                    this.SysMsg(sCharName + "已加入禁止人物列表", TMsgColor.c_Green, TMsgType.t_Hint);
                }
                else
                {
                    //M2Share.g_DenyChrNameList.Add(sCharName, ((0) as Object));
                    this.SysMsg(sCharName + "已加入临时禁止人物列表", TMsgColor.c_Green, TMsgType.t_Hint);
                }
            }
            finally
            {
                M2Share.g_DenyChrNameList.UnLock();
            }
        }

        public void CmdDenyIPaddrLogon(TGameCmd Cmd, string sIPaddr, string sFixDeny)
        {
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (sIPaddr == "")
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " IP地址 是否永久封(0,1)", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            //M2Share.g_DenyIPAddrList.__Lock();
            try
            {
                if ((sFixDeny != "") && (sFixDeny[0] == '1'))
                {
                    //M2Share.g_DenyIPAddrList.Add(sIPaddr, ((1) as Object));
                    M2Share.SaveDenyIPAddrList();
                    this.SysMsg(sIPaddr + "已加入禁止登录IP列表", TMsgColor.c_Green, TMsgType.t_Hint);
                }
                else
                {
                    //M2Share.g_DenyIPAddrList.Add(sIPaddr, ((0) as Object));
                    this.SysMsg(sIPaddr + "已加入临时禁止登录IP列表", TMsgColor.c_Green, TMsgType.t_Hint);
                }
            }
            finally
            {
                //M2Share.g_DenyIPAddrList.UnLock();
            }
        }

        public void CmdDisableFilter(string sCmd, string sParam1)
        {
            if ((this.m_btPermission < 6))
            {
                return;
            }
            if ((sParam1 != "") && (sParam1[0] == '?'))
            {
                this.SysMsg("启用/禁止文字过滤功能。", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            M2Share.boFilterWord = !M2Share.boFilterWord;
            if (M2Share.boFilterWord)
            {
                this.SysMsg("已启用文字过滤。", TMsgColor.c_Green, TMsgType.t_Hint);
            }
            else
            {
                this.SysMsg("已禁止文字过滤。", TMsgColor.c_Green, TMsgType.t_Hint);
            }
        }

        // 恢复禁止登陆帐号
        public void CmdDelDenyAccountLogon(TGameCmd Cmd, string sAccount, string sFixDeny)
        {
            int I = 0;
            bool boDelete;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (sAccount == "")
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " 登录帐号", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            boDelete = false;
            //M2Share.g_DenyAccountList.__Lock();
            try
            {
                for (I = M2Share.g_DenyAccountList.Count - 1; I >= 0; I--)
                {
                    // 20080917 修改
                    if (M2Share.g_DenyAccountList.Count <= 0)
                    {
                        break;
                    }
                    // 20080917
                    if ((sAccount).ToLower().CompareTo((M2Share.g_DenyAccountList[I]).ToLower()) == 0)
                    {
                        //if (((int)M2Share.g_DenyAccountList[I]) != 0)
                        //{
                        //    M2Share.SaveDenyAccountList();
                        //}
                        //M2Share.g_DenyAccountList.Remove(I);
                        this.SysMsg(sAccount + "已从禁止登录帐号列表中删除。", TMsgColor.c_Green, TMsgType.t_Hint);
                        boDelete = true;
                        break;
                    }
                }
                // for
            }
            finally
            {
                //  M2Share.g_DenyAccountList.UnLock();
            }
            if (!boDelete)
            {
                this.SysMsg(sAccount + "没有被禁止登录。", TMsgColor.c_Green, TMsgType.t_Hint);
            }
        }

        // 恢复禁止登陆人物
        public void CmdDelDenyCharNameLogon(TGameCmd Cmd, string sCharName, string sFixDeny)
        {
            bool boDelete;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (sCharName == "")
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " 人物名称", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            boDelete = false;
            //M2Share.g_DenyChrNameList.__Lock();
            try
            {
                for (int I = M2Share.g_DenyChrNameList.Count - 1; I >= 0; I--)
                {
                    if (M2Share.g_DenyChrNameList.Count <= 0)
                    {
                        break;
                    }
                    if ((sCharName).ToLower().CompareTo((M2Share.g_DenyChrNameList[I]).ToLower()) == 0)
                    {
                        //if (((int)M2Share.g_DenyChrNameList[I]) != 0)
                        //{
                        //    M2Share.SaveDenyChrNameList();
                        //}
                        M2Share.g_DenyChrNameList.RemoveAt(I);
                        this.SysMsg(sCharName + "已从禁止登录人物列表中删除。", TMsgColor.c_Green, TMsgType.t_Hint);
                        boDelete = true;
                        break;
                    }
                }
            }
            finally
            {
                // M2Share.g_DenyChrNameList.UnLock();
            }
            if (!boDelete)
            {
                this.SysMsg(sCharName + "没有被禁止登录。", TMsgColor.c_Green, TMsgType.t_Hint);
            }
        }

        // 恢复禁止登陆IP
        public void CmdDelDenyIPaddrLogon(TGameCmd Cmd, string sIPaddr, string sFixDeny)
        {
            bool boDelete;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (sIPaddr == "")
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " IP地址", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            boDelete = false;
            M2Share.g_DenyIPAddrList.__Lock();
            try
            {
                for (int I = M2Share.g_DenyIPAddrList.Count - 1; I >= 0; I--)
                {
                    if (M2Share.g_DenyIPAddrList.Count <= 0)
                    {
                        break;
                    }
                    if ((sIPaddr).ToLower().CompareTo((M2Share.g_DenyIPAddrList[I]).ToLower()) == 0)
                    {
                        //if (((int)M2Share.g_DenyIPAddrList[I]) != 0)
                        //{
                        //    M2Share.SaveDenyIPAddrList();
                        //}
                        M2Share.g_DenyIPAddrList.RemoveAt(I);
                        this.SysMsg(sIPaddr + "已从禁止登录IP列表中删除。", TMsgColor.c_Green, TMsgType.t_Hint);
                        boDelete = true;
                        break;
                    }
                }
            }
            finally
            {
                M2Share.g_DenyIPAddrList.UnLock();
            }
            if (!boDelete)
            {
                this.SysMsg(sIPaddr + "没有被禁止登录。", TMsgColor.c_Green, TMsgType.t_Hint);
            }
        }

        // 查看禁止登陆帐号
        public void CmdShowDenyAccountLogon(TGameCmd Cmd, string sAccount, string sFixDeny)
        {
            if ((this.m_btPermission < 6))
            {
                return;
            }
            M2Share.g_DenyAccountList.__Lock();
            try
            {
                if (M2Share.g_DenyAccountList.Count <= 0)
                {
                    this.SysMsg("禁止登录帐号列表为空。", TMsgColor.c_Green, TMsgType.t_Hint);
                    return;
                }
                for (int I = 0; I < M2Share.g_DenyAccountList.Count; I++)
                {
                    this.SysMsg(M2Share.g_DenyAccountList[I], TMsgColor.c_Green, TMsgType.t_Hint);
                }
            }
            finally
            {
                M2Share.g_DenyAccountList.UnLock();
            }
        }

        // 查看禁止登录角色列表
        public void CmdShowDenyCharNameLogon(TGameCmd Cmd, string sCharName, string sFixDeny)
        {
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            M2Share.g_DenyChrNameList.__Lock();
            try
            {
                if (M2Share.g_DenyChrNameList.Count <= 0)
                {
                    this.SysMsg("禁止登录角色列表为空。", TMsgColor.c_Green, TMsgType.t_Hint);
                    return;
                }
                for (int I = 0; I < M2Share.g_DenyChrNameList.Count; I++)
                {
                    this.SysMsg(M2Share.g_DenyChrNameList[I], TMsgColor.c_Green, TMsgType.t_Hint);
                }
            }
            finally
            {
                M2Share.g_DenyChrNameList.UnLock();
            }
        }

        // 查看禁止登陆IP
        public void CmdShowDenyIPaddrLogon(TGameCmd Cmd, string sIPaddr, string sFixDeny)
        {
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            M2Share.g_DenyIPAddrList.__Lock();
            try
            {
                if (M2Share.g_DenyIPAddrList.Count <= 0)
                {
                    this.SysMsg("禁止登录角色列表为空。", TMsgColor.c_Green, TMsgType.t_Hint);
                    return;
                }
                for (int I = 0; I < M2Share.g_DenyIPAddrList.Count; I++)
                {
                    this.SysMsg(M2Share.g_DenyIPAddrList[I], TMsgColor.c_Green, TMsgType.t_Hint);
                }
            }
            finally
            {
                M2Share.g_DenyIPAddrList.UnLock();
            }
        }

        public void CmdDisableSendMsg(TGameCmd Cmd, string sHumanName)
        {
            TPlayObject PlayObject;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (sHumanName == "")
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " 人物名称", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumanName);
            if (PlayObject != null)
            {
                PlayObject.m_boFilterSendMsg = true;
            }
            //M2Share.g_DisableSendMsgList.Add(sHumanName);
            //M2Share.SaveDisableSendMsgList();
            this.SysMsg(sHumanName + " 已加入禁言列表。", TMsgColor.c_Green, TMsgType.t_Hint);
        }

        public void CmdDisableSendMsgList(TGameCmd Cmd)
        {
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (M2Share.g_DisableSendMsgList.Count <= 0)
            {
                this.SysMsg("禁言列表为空！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            this.SysMsg("禁言列表:", TMsgColor.c_Blue, TMsgType.t_Hint);
            for (int I = 0; I < M2Share.g_DisableSendMsgList.Count; I++)
            {
                this.SysMsg(M2Share.g_DisableSendMsgList[I], TMsgColor.c_Green, TMsgType.t_Hint);
            }
        }

        public void CmdEnableSendMsg(TGameCmd Cmd, string sHumanName)
        {
            TPlayObject PlayObject;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (sHumanName == "")
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " 人物名称", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            for (int I = M2Share.g_DisableSendMsgList.Count - 1; I >= 0; I--)
            {
                if (M2Share.g_DisableSendMsgList.Count <= 0)
                {
                    break;
                }
                if ((sHumanName).ToLower().CompareTo((M2Share.g_DisableSendMsgList[I]).ToLower()) == 0)
                {
                    PlayObject = UserEngine.GetPlayObject(sHumanName);
                    if (PlayObject != null)
                    {
                        PlayObject.m_boFilterSendMsg = false;
                    }
                    M2Share.g_DisableSendMsgList.RemoveAt(I);
                    //M2Share.SaveDisableSendMsgList();
                    this.SysMsg(sHumanName + " 已从禁言列表中删除。", TMsgColor.c_Green, TMsgType.t_Hint);
                    return;
                }
            }
            // for
            this.SysMsg(sHumanName + " 没有被禁言！！！", TMsgColor.c_Red, TMsgType.t_Hint);
        }

        // 退出行会
        public void CmdEndGuild()
        {
            if ((this.m_MyGuild != null))
            {
                if ((this.m_nGuildRankNo > 1))
                {
                    if (((TGUild)(this.m_MyGuild)).IsMember(this.m_sCharName) && ((TGUild)(this.m_MyGuild)).DelMember(this.m_sCharName))
                    {
                        UserEngine.SendServerGroupMsg(Grobal2.SS_207, M2Share.nServerIndex, ((TGUild)(this.m_MyGuild)).sGuildName);
                        this.m_MyGuild = null;
                        RefRankInfo(0, "");
                        this.RefShowName();
                        this.SysMsg(string.Format("您已离开{0}行会。", ((TGUild)(this.m_MyGuild)).sGuildName), TMsgColor.c_Green, TMsgType.t_Hint);
                    }
                }
                else
                {
                    this.SysMsg("行会掌门人不能这样退出行会！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                }
            }
            else
            {
                this.SysMsg("您都没加入行会！！！", TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        public void CmdForcedWallconquestWar(TGameCmd Cmd, string sCASTLENAME)
        {
            TUserCastle Castle;
            string s20;
            TGUild Guild;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (sCASTLENAME == "")
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " 城堡名称", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            Castle = M2Share.g_CastleManager.Find(sCASTLENAME);
            if (Castle != null)
            {
                Castle.m_boUnderWar = !Castle.m_boUnderWar;// 设置为可以攻城
                if (Castle.m_boUnderWar) // 正在攻城
                {
                    if (GuildManager.GuildList.Count > 0)  // 增加所有行会为攻城行会
                    {
                        for (int I = 0; I < GuildManager.GuildList.Count; I++)
                        {
                            Guild = ((TGUild)(GuildManager.GuildList[I]));
                            Castle.m_AttackGuildList.Add(Guild);
                        }
                    }
                    Castle.m_boShowOverMsg = false;
                    Castle.m_WarDate = DateTime.Now;
                    Castle.m_dwStartCastleWarTick = HUtil32.GetTickCount();
                    Castle.StartWallconquestWar();
                    UserEngine.SendServerGroupMsg(Grobal2.SS_212, M2Share.nServerIndex, "");
                    s20 = "[" + Castle.m_sName + " 攻城战已经开始]";
                    UserEngine.SendBroadCastMsg(s20, TMsgType.t_System);
                    UserEngine.SendServerGroupMsg(Grobal2.SS_204, M2Share.nServerIndex, s20);
                    Castle.MainDoorControl(true);
                }
                else
                {
                    Castle.StopWallconquestWar();
                }
            }
            else
            {
                this.SysMsg(string.Format(GameMsgDef.g_sGameCommandSbkGoldCastleNotFoundMsg, sCASTLENAME), TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        public void CmdFreePenalty(TGameCmd Cmd, string sHumanName)
        {
            TPlayObject PlayObject;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (((sHumanName != "") && (sHumanName[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, Cmd.sCmd, GameMsgDef.g_sGameCommandFreePKHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumanName);
            if (PlayObject == null)
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, sHumanName), TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            PlayObject.m_nPkPoint = 0;
            PlayObject.RefNameColor();
            PlayObject.SysMsg(GameMsgDef.g_sGameCommandFreePKHumanMsg, TMsgColor.c_Green, TMsgType.t_Hint);
            this.SysMsg(string.Format(GameMsgDef.g_sGameCommandFreePKMsg, sHumanName), TMsgColor.c_Green, TMsgType.t_Hint);
        }

        // 改变头发
        public void CmdHair(TGameCmd Cmd, string sHumanName, int nHair)
        {
            TPlayObject PlayObject;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sHumanName == "") || (nHair < 0))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " 人物名称 类型值", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumanName);
            if (PlayObject != null)
            {
                PlayObject.m_btHair = (byte)nHair;
                PlayObject.FeatureChanged();
                this.SysMsg(sHumanName + " 的头发已改变。", TMsgColor.c_Green, TMsgType.t_Hint);
            }
            else
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, sHumanName), TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        public void CmdHumanLocal(TGameCmd Cmd, string sHumanName)
        {
            TPlayObject PlayObject;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sHumanName == "") || ((sHumanName != "") && (sHumanName[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, Cmd.sCmd, GameMsgDef.g_sGameCommandHumanLocalHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumanName);
            if (PlayObject == null)
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, sHumanName), TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            this.SysMsg(string.Format(GameMsgDef.g_sGameCommandHumanLocalMsg, sHumanName, m_sIPLocal), TMsgColor.c_Green, TMsgType.t_Hint);
        }

        // 调整人物PK值
        public void CmdHunger(string sCmd, string sHumanName, int nHungerPoint)
        {
            TPlayObject PlayObject;
            if ((this.m_btPermission < 6))
            {
                return;
            }
            if ((sHumanName == "") || (nHungerPoint < 0))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + sCmd + " 人物名称 能量值", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumanName);
            if (PlayObject != null)
            {
                PlayObject.m_nHungerStatus = nHungerPoint;
                PlayObject.SendMsg(PlayObject, Grobal2.RM_MYSTATUS, 0, 0, 0, 0, "");
                PlayObject.RefMyStatus();
                this.SysMsg(sHumanName + " 的能量值已改变。", TMsgColor.c_Green, TMsgType.t_Hint);
            }
            else
            {
                this.SysMsg(sHumanName + "没有在线！！！", TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        // 增加人物PK值
        public void CmdIncPkPoint(TGameCmd Cmd, string sHumanName, int nPoint)
        {
            TPlayObject PlayObject;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (((sHumanName != "") && (sHumanName[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, Cmd.sCmd, GameMsgDef.g_sGameCommandIncPkPointHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumanName);
            if (PlayObject == null)
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, sHumanName), TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            PlayObject.m_nPkPoint += nPoint;
            PlayObject.RefNameColor();
            if (nPoint > 0)
            {
                this.SysMsg(string.Format(GameMsgDef.g_sGameCommandIncPkPointAddPointMsg, sHumanName, nPoint), TMsgColor.c_Green, TMsgType.t_Hint);
            }
            else
            {
                this.SysMsg(string.Format(GameMsgDef.g_sGameCommandIncPkPointDecPointMsg, sHumanName, -nPoint), TMsgColor.c_Green, TMsgType.t_Hint);
            }
        }

        public void CmdKickHuman(TGameCmd Cmd, string sHumName)
        {
            TPlayObject PlayObject;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sHumName == "") || ((sHumName != "") && (sHumName[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, Cmd.sCmd, GameMsgDef.g_sGameCommandKickHumanHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumName);
            if (PlayObject != null)
            {
                PlayObject.m_boKickFlag = true;
                PlayObject.m_boEmergencyClose = true;
                PlayObject.m_boPlayOffLine = false;
                PlayObject.m_boNotOnlineAddExp = false;
            }
            else
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, sHumName), TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        public void CmdLotteryTicket(string sCmd, int nPermission, string sParam1)
        {
            if ((this.m_btPermission < nPermission))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sParam1 == "") || ((sParam1 != "") && (sParam1[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, new string[] { sCmd, "" }), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            this.SysMsg(string.Format(GameMsgDef.g_sGameCommandLotteryTicketMsg, GameConfig.nWinLotteryCount, GameConfig.nNoWinLotteryCount, GameConfig.nWinLotteryLevel1, GameConfig.nWinLotteryLevel2, GameConfig.nWinLotteryLevel3, GameConfig.nWinLotteryLevel4, GameConfig.nWinLotteryLevel5, GameConfig.nWinLotteryLevel6), TMsgColor.c_Green, TMsgType.t_Hint);
        }

        // 调整指定人物的幸运值
        public void CmdLuckPoint(string sCmd, int nPermission, string sHumanName, string sCtr, string sPoint)
        {
            TPlayObject PlayObject;
            char cMethod;
            int nPoint;
            if ((this.m_btPermission < nPermission))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sHumanName == "") || ((sHumanName != "") && (sHumanName[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, sCmd, GameMsgDef.g_sGameCommandLuckPointHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumanName);
            if (PlayObject == null)
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, sHumanName), TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (sCtr == "")
            {
                this.SysMsg(string.Format(GameMsgDef.g_sGameCommandLuckPointMsg, sHumanName, PlayObject.m_nBodyLuckLevel, PlayObject.m_dBodyLuck, PlayObject.m_nLuck), TMsgColor.c_Green, TMsgType.t_Hint);
                return;
            }
            nPoint = HUtil32.Str_ToInt(sPoint, 0);
            cMethod = sCtr[0];
            switch (cMethod)
            {
                case '=':
                    PlayObject.m_nLuck = nPoint;
                    break;
                case '-':
                    if (PlayObject.m_nLuck >= nPoint)
                    {
                        PlayObject.m_nLuck -= nPoint;
                    }
                    else
                    {
                        PlayObject.m_nLuck = 0;
                    }
                    break;
                case '+':
                    PlayObject.m_nLuck += nPoint;
                    break;
            }
        }

        public void CmdMapMove(TGameCmd Cmd, string sMapName)
        {
            TEnvirnoment Envir;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sMapName == "") || ((sMapName != "") && (sMapName[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, Cmd.sCmd, GameMsgDef.g_sGameCommandMoveHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            Envir = M2Share.g_MapManager.FindMap(sMapName);
            if ((Envir == null))
            {
                this.SysMsg(string.Format(GameMsgDef.g_sTheMapNotFound, sMapName), TMsgColor.c_Red, TMsgType.t_Hint);// + ' 此地图号不存在！！！'
                return;
            }
            if ((this.m_btPermission >= Cmd.nPermissionMax) || M2Share.CanMoveMap(sMapName))
            {
                this.SendRefMsg(Grobal2.RM_SPACEMOVE_FIRE, 0, 0, 0, 0, "");
                this.MapRandomMove(sMapName, 0);
            }
            else
            {
                // '地图 ' + sParam1 + ' 不允许传送！！！'
                this.SysMsg(string.Format(GameMsgDef.g_sTheMapDisableMove, new string[] { sMapName, Envir.sMapDesc }), TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        // 准确移动
        public void CmdPositionMove(TGameCmd Cmd, string sMapName, string sX, string sY)
        {
            TEnvirnoment Envir = null;
            int nX;
            int nY;
            try
            {
                if ((this.m_btPermission < Cmd.nPermissionMin))
                {
                    this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                    return;
                }
                if ((sMapName == "") || (sX == "") || (sY == "") || ((sMapName != "") && (sMapName[0] == '?')))
                {
                    if (GameConfig.boGMShowFailMsg)
                    {
                        this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, Cmd.sCmd, GameMsgDef.g_sGameCommandPositionMoveHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    return;
                }
                if ((this.m_btPermission >= Cmd.nPermissionMax) || M2Share.CanMoveMap(sMapName))
                {
                    Envir = M2Share.g_MapManager.FindMap(sMapName);
                    if (Envir != null)
                    {
                        nX = HUtil32.Str_ToInt(sX, 0);
                        nY = HUtil32.Str_ToInt(sY, 0);
                        if (Envir.CanWalk(nX, nY, true))
                        {
                            this.SpaceMove(sMapName, nX, nY, 0);
                        }
                        else
                        {
                            this.SysMsg(string.Format(GameMsgDef.g_sGameCommandPositionMoveCanotMoveToMap, new string[] { sMapName, sX, sY }), TMsgColor.c_Green, TMsgType.t_Hint);
                        }
                    }
                }
                else
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sTheMapDisableMove, sMapName, Envir.sMapDesc), TMsgColor.c_Red, TMsgType.t_Hint);
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.CmdPositionMove");
            }
        }

        public void CmdMapMoveHuman(TGameCmd Cmd, string sSrcMap, string sDenMap)
        {
            TEnvirnoment SrcEnvir;
            TEnvirnoment DenEnvir;
            List<TPlayObject> HumanList;
            int I;
            TPlayObject MoveHuman;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sDenMap == "") || (sSrcMap == "") || ((sSrcMap != "") && (sSrcMap[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, Cmd.sCmd, GameMsgDef.g_sGameCommandMapMoveHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            SrcEnvir = M2Share.g_MapManager.FindMap(sSrcMap);
            DenEnvir = M2Share.g_MapManager.FindMap(sDenMap);
            if ((SrcEnvir == null))
            {
                this.SysMsg(string.Format(GameMsgDef.g_sGameCommandMapMoveMapNotFound, sSrcMap), TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((DenEnvir == null))
            {
                this.SysMsg(string.Format(GameMsgDef.g_sGameCommandMapMoveMapNotFound, sDenMap), TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            HumanList = new List<TPlayObject>();
            try
            {
                UserEngine.GetMapRageHuman(SrcEnvir, SrcEnvir.m_nWidth / 2, SrcEnvir.m_nHeight / 2, 1000, HumanList);
                for (I = 0; I < HumanList.Count; I++)
                {
                    MoveHuman = ((HumanList[I]) as TPlayObject);
                    if (MoveHuman != this)
                    {
                        MoveHuman.MapRandomMove(sDenMap, 0);
                    }
                }
            }
            finally
            {
                Dispose(HumanList);
            }
        }

        public void CmdUserCmd(string sLable)
        {
            byte Flag;
            Flag = 0;
            if (m_nUserCmdNPC == M2Share.g_FunctionNPC)
            {
                M2Share.g_FunctionNPC.GotoLable(this, sLable, false);
                Flag = 8;
            }
            else if (m_nUserCmdNPC == M2Share.g_BatterNPC)
            {
                M2Share.g_BatterNPC.GotoLable(this, sLable, false);
                Flag = 8;
            }
            if (Flag != 8)
            {
                M2Share.g_FunctionNPC.GotoLable(this, sLable, false);// 执行默认脚本  修复不能执行自定义脚本问题
            }
            m_nUserCmdNPC = null;
        }

        // 自定义命令
        public bool PlayObjectUserCmd(string sLable, string sParam)
        {
            bool result = false;
            int nCode = 0;
            try
            {
                if ((M2Share.g_UserCmdList == null) || (M2Share.g_UserCmdList.Count <= 0))
                {
                    return result;
                }
                for (int I = 0; I < M2Share.g_UserCmdList.Count; I++)
                {
                    if ((sLable).ToLower().CompareTo((M2Share.g_UserCmdList[I]).ToLower()) == 0)
                    {
                        if (M2Share.g_FunctionNPC == null)
                        {
                            break;
                        }
                        m_nScriptGotoCount = 0;//初始化跳转次数
                        //nCode = ((int)M2Share.g_UserCmdList[I]);
                        sLable = "@UserCmd" + (nCode).ToString();
                        if ((nCode > 99) || (nCode < 0))
                        {
                            nCode = 0;
                        }
                        m_sString[nCode] = sParam;
                        m_nInteger[nCode] = HUtil32.Str_ToInt(sParam, 0);
                        CmdUserCmd(sLable);// 执行QF触发
                        result = true;
                        break;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.PlayObjectUserCmd");
            }
            return result;
        }

        public void CmdMemberFunction(string sCmd, string sParam)
        {
            if ((sParam != "") && (sParam[0] == '?'))
            {
                this.SysMsg("打开会员功能窗口.", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (M2Share.g_ManageNPC != null)
            {
                M2Share.g_ManageNPC.GotoLable(this, "@Member", false);
            }
        }

        public void CmdMission(TGameCmd Cmd, string sX, string sY)
        {
            int nX;
            int nY;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sX == "") || (sY == ""))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " X  Y", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            nX = HUtil32.Str_ToInt(sX, 0);
            nY = HUtil32.Str_ToInt(sY, 0);
            M2Share.g_boMission = true;
            M2Share.g_sMissionMap = this.m_sMapName;
            M2Share.g_nMissionX = nX;
            M2Share.g_nMissionY = nY;
            this.SysMsg("怪物集中目标已设定为: " + this.m_sMapName + "(" + (M2Share.g_nMissionX).ToString() + ":" +
                (M2Share.g_nMissionY).ToString() + ")", TMsgColor.c_Green, TMsgType.t_Hint);
        }

        public void CmdHumanCount(TGameCmd Cmd, string sMapName)
        {
            TEnvirnoment Envir;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sMapName == "") || ((sMapName != "") && (sMapName[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, Cmd.sCmd, GameMsgDef.g_sGameCommandHumanCountHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            Envir = M2Share.g_MapManager.FindMap(sMapName);
            if (Envir == null)
            {
                this.SysMsg(GameMsgDef.g_sGameCommandMobCountMapNotFound, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            this.SysMsg(string.Format(GameMsgDef.g_sGameCommandMobCountMonsterCount, UserEngine.GetMapHuman(sMapName)), TMsgColor.c_Green, TMsgType.t_Hint);
        }

        public void CmdMobFireBurn(TGameCmd Cmd, string sMAP, string sX, string sY, string sType, string sTime, string sPoint)
        {
            int nX;
            int nY;
            int nType;
            int nTime;
            int nPoint;
            TFireBurnEvent FireBurnEvent;
            TEnvirnoment Envir;
            TEnvirnoment OldEnvir;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sMAP == "") || ((sMAP != "") && (sMAP[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandMobFireBurnHelpMsg, Cmd.sCmd, sMAP, sX, sY, sType, sTime, sPoint), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            nX = HUtil32.Str_ToInt(sX, -1);
            nY = HUtil32.Str_ToInt(sY, -1);
            nType = HUtil32.Str_ToInt(sType, -1);
            nTime = HUtil32.Str_ToInt(sTime, -1);
            nPoint = HUtil32.Str_ToInt(sPoint, -1);
            if (nPoint < 0)
            {
                nPoint = 1;
            }
            if ((sMAP == "") || (nX < 0) || (nY < 0) || (nType < 0) || (nTime < 0) || (nPoint < 0))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandMobFireBurnHelpMsg, new string[] { Cmd.sCmd, sMAP, sX, sY, sType, sTime, sPoint }), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            Envir = M2Share.g_MapManager.FindMap(sMAP);
            if (Envir != null)
            {
                OldEnvir = this.m_PEnvir;
                this.m_PEnvir = Envir;
                FireBurnEvent = new TFireBurnEvent(this, nX, nY, nType, Convert.ToUInt32(nTime * 1000), nPoint);
                M2Share.g_EventManager.AddEvent(FireBurnEvent);
                this.m_PEnvir = OldEnvir;
                return;
            }
            this.SysMsg(string.Format(GameMsgDef.g_sGameCommandMobFireBurnMapNotFountMsg, new string[] { Cmd.sCmd, sMAP }), TMsgColor.c_Red, TMsgType.t_Hint);
        }

        public void CmdPrvMsg(string sCmd, int nPermission, string sHumanName)
        {
            if ((this.m_btPermission < nPermission))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sHumanName == "") || ((sHumanName != "") && (sHumanName[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, sCmd, GameMsgDef.g_sGameCommandPrvMsgHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            for (int I = m_BlockWhisperList.Count - 1; I >= 0; I--)
            {
                if (m_BlockWhisperList.Count <= 0)
                {
                    break;
                }
                if ((m_BlockWhisperList[I]).ToLower().CompareTo((sHumanName).ToLower()) == 0)
                {
                    m_BlockWhisperList.RemoveAt(I);
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandPrvMsgUnLimitMsg, sHumanName), TMsgColor.c_Green, TMsgType.t_Hint);
                    return;
                }
            }
            m_BlockWhisperList.Add(sHumanName);
            this.SysMsg(string.Format(GameMsgDef.g_sGameCommandPrvMsgLimitMsg, new string[] { sHumanName }), TMsgColor.c_Green, TMsgType.t_Hint);
        }

        public void CmdRecallHuman(TGameCmd Cmd, string sHumanName)
        {
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sHumanName == "") || ((sHumanName != "") && (sHumanName[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, Cmd.sCmd, GameMsgDef.g_sGameCommandRecallHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            RecallHuman(sHumanName);
        }

        // ------------------------------------------------------------------------------
        // 20080122 召唤宝宝，宝宝等级直接为1级
        public void CmdRECALLMOBEX(TGameCmd Cmd, string sMonName, int nNameColor, int nX, int nY)
        {
            TBaseObject mon;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sMonName == "") || ((sMonName != "") && (sMonName[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, Cmd.sCmd, GameMsgDef.g_sGameCommandRecallMobExHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            if (nX < 0)
            {
                nX = 0;
            }
            if (nY < 0)
            {
                nY = 0;
            }
            if (nNameColor < 0)
            {
                nNameColor = 0;
            }
            if (nNameColor > 255)
            {
                nNameColor = 255;
            }
            mon = UserEngine.RegenMonsterByName(this.m_PEnvir.sMapName, nX, nY, sMonName);
            if (mon != null)
            {
                mon.m_Master = this;
                mon.m_dwMasterRoyaltyTick = 86400000;// 24 * 60 * 60 * 1000
                mon.m_dwMasterRoyaltyTime = HUtil32.GetTickCount();// 20080813 增加
                mon.m_btSlaveMakeLevel = 3;
                mon.m_btSlaveExpLevel = 1;
                mon.m_btNameColor = (byte)nNameColor;
                mon.RecalcAbilitys();
                mon.RefNameColor();
                this.m_SlaveList.Add(mon);
            }
        }

        /// <summary>
        /// MOVEMOBTO 怪物名称 原地图 原X 原Y 新地图 新X 新Y
        /// 将指定坐标的怪物移动到新坐标，名称为ALL则移动该坐标所有怪物
        /// </summary>
        /// <param name="Cmd"></param>
        /// <param name="sMonName"></param>
        /// <param name="OleMap"></param>
        /// <param name="NewMap"></param>
        /// <param name="nX"></param>
        /// <param name="nY"></param>
        /// <param name="OnX"></param>
        /// <param name="OnY"></param>
        public void CmdMOVEMOBTO(TGameCmd Cmd, string sMonName, string OleMap, string NewMap, int nX, int nY, int OnX, int OnY)
        {
            bool boMoveAll;
            TEnvirnoment SrcEnvir;
            TEnvirnoment DenEnvir;
            List<TBaseObject> MonList;
            TBaseObject MoveMon;
            int I;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sMonName == "") || (OleMap == "") || (NewMap == "") || ((sMonName != "") && (sMonName[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, Cmd.sCmd, GameMsgDef.g_sGameCommandMOVEMOBTOHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            boMoveAll = false;
            if (sMonName == "ALL")
            {
                boMoveAll = true;
            }
            if (nX < 0)
            {
                nX = 0;
            }
            if (nY < 0)
            {
                nY = 0;
            }
            if (OnX < 0)
            {
                OnX = 0;
            }
            if (OnY < 0)
            {
                OnY = 0;
            }
            SrcEnvir = M2Share.g_MapManager.FindMap(OleMap);// 原地图
            DenEnvir = M2Share.g_MapManager.FindMap(NewMap);// 新地图
            if ((SrcEnvir == null) || (DenEnvir == null))
            {
                return;
            }
            MonList = new List<TBaseObject>();
            if (!boMoveAll)// 指定名称的怪移动
            {
                UserEngine.GetMapRangeMonster(SrcEnvir, OnX, OnY, 10, MonList);// 查指定XY范围内的怪
                if (MonList.Count > 0)
                {
                    for (I = 0; I < MonList.Count; I++)
                    {
                        MoveMon = MonList[I];
                        if (MoveMon != this)
                        {
                            if ((MoveMon.m_sCharName).ToLower().CompareTo((sMonName).ToLower()) == 0) // 是否是指定名称的怪
                            {
                                MoveMon.SpaceMove(NewMap, nX, nY, 0);
                            }
                        }
                    }
                }
            }
            else
            {
                // 所有怪移动
                UserEngine.GetMapRangeMonster(SrcEnvir, OnX, OnY, 1000, MonList);// 查指定XY范围内的怪
                for (I = 0; I < MonList.Count; I++)
                {
                    MoveMon = MonList[I];
                    if (MoveMon != this)
                    {
                        MoveMon.SpaceMove(NewMap, nX, nY, 0);
                    }
                }
            }
            Dispose(MonList);
        }

        public void CmdReconnection(string sCmd, string sIPaddr, string sPort)
        {
            if ((this.m_btPermission < 10))
            {
                return;
            }
            if ((sIPaddr != "") && (sIPaddr[0] == '?'))
            {
                this.SysMsg("此命令用于改变客户端连接网关的IP及端口。", TMsgColor.c_Blue, TMsgType.t_Hint);
                return;
            }
            if ((sIPaddr == "") || (sPort == ""))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + sCmd + " IP地址 端口", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            if ((sIPaddr != "") && (sPort != ""))
            {
                this.SendMsg(this, Grobal2.RM_RECONNECTION, 0, 0, 0, 0, sIPaddr + "/" + sPort);
            }
        }

        public unsafe void CmdRefineWeapon(TGameCmd Cmd, int nDc, int nMc, int nSc, int nHit)
        {
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((nDc + nMc + nSc) > 10)
            {
                return;
            }
            if (this.m_UseItems[TPosition.U_WEAPON]->wIndex <= 0)
            {
                return;
            }
            this.m_UseItems[TPosition.U_WEAPON]->btValue[0] = (byte)nDc;
            this.m_UseItems[TPosition.U_WEAPON]->btValue[1] = (byte)nMc;
            this.m_UseItems[TPosition.U_WEAPON]->btValue[2] = (byte)nSc;
            this.m_UseItems[TPosition.U_WEAPON]->btValue[5] = (byte)nHit;
            SendUpdateItem(this.m_UseItems[TPosition.U_WEAPON]);
            RecalcAbilitys();
            this.CompareSuitItem(false);
            this.SendMsg(this, Grobal2.RM_ABILITY, 0, 0, 0, 0, "");
            this.SendMsg(this, Grobal2.RM_SUBABILITY, 0, 0, 0, 0, "");
            M2Share.MainOutMessage("[武器调整]" + this.m_sCharName + " DC:" + nDc + " MC" + nMc + " SC" + nSc + " HIT:" + nHit);
        }

        public void CmdReGotoHuman(TGameCmd Cmd, string sHumanName)
        {
            TPlayObject PlayObject;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sHumanName == "") || ((sHumanName != "") && (sHumanName[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, Cmd.sCmd, GameMsgDef.g_sGameCommandReGotoHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumanName);
            if (PlayObject == null)
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, sHumanName), TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            this.SpaceMove(PlayObject.m_PEnvir.sMapName, PlayObject.m_nCurrX, PlayObject.m_nCurrY, 0);
        }

        public void CmdReloadAbuse(string sCmd, int nPermission, string sParam1)
        {
            if ((this.m_btPermission < nPermission))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (((sParam1 != "") && (sParam1[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, sCmd, ""), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
        }

        public void CmdReLoadAdmin(string sCmd)
        {
            if (this.m_btPermission < 6)
            {
                return;
            }
            LocalDB.GetInstance().LoadAdminList();
            UserEngine.SendServerGroupMsg(213, M2Share.nServerIndex, "");
            this.SysMsg("管理员列表重新加载成功...", TMsgColor.c_Green, TMsgType.t_Hint);
        }

        // 重新加载指定行会
        public void CmdReloadGuild(string sCmd, int nPermission, string sParam1)
        {
            TGUild Guild;
            if ((this.m_btPermission < nPermission))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sParam1 == "") || ((sParam1 != "") && (sParam1[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, sCmd, GameMsgDef.g_sGameCommandReloadGuildHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            if (M2Share.nServerIndex != 0)
            {
                this.SysMsg(GameMsgDef.g_sGameCommandReloadGuildOnMasterserver, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            Guild = GuildManager.FindGuild(sParam1);
            if (Guild == null)
            {
                this.SysMsg(string.Format(GameMsgDef.g_sGameCommandReloadGuildNotFoundGuildMsg, new string[] { sParam1 }), TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            Guild.LoadGuild();
            this.SysMsg(string.Format(GameMsgDef.g_sGameCommandReloadGuildSuccessMsg, new string[] { sParam1 }), TMsgColor.c_Red, TMsgType.t_Hint);
            UserEngine.SendServerGroupMsg(Grobal2.SS_207, M2Share.nServerIndex, sParam1);
        }

        public void CmdReloadLineNotice(string sCmd, int nPermission, string sParam1)
        {
            if ((this.m_btPermission < nPermission))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (((sParam1 != "") && (sParam1[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, sCmd, ""), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            if (M2Share.LoadLineNotice(GameConfig.sNoticeDir + "LineNotice.txt"))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandReloadLineNoticeSuccessMsg, TMsgColor.c_Green, TMsgType.t_Hint);
            }
            else
            {
                this.SysMsg(GameMsgDef.g_sGameCommandReloadLineNoticeFailMsg, TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        public void CmdReloadManage(TGameCmd Cmd, string sParam)
        {
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (((sParam != "") && (sParam[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, new string[] { Cmd.sCmd, "" }), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            if (sParam == "")
            {
                if (M2Share.g_ManageNPC != null)
                {
                    M2Share.g_ManageNPC.ClearScript();
                    M2Share.g_ManageNPC.LoadNpcScript();
                    this.SysMsg("重新加载登录脚本完成...", TMsgColor.c_Green, TMsgType.t_Hint);
                }
                else
                {
                    this.SysMsg("重新加载登录脚本失败...", TMsgColor.c_Green, TMsgType.t_Hint);
                }
            }
            else
            {
                if (M2Share.g_FunctionNPC != null)
                {
                    M2Share.g_FunctionNPC.ClearScript();
                    M2Share.g_FunctionNPC.LoadNpcScript();
                    this.SysMsg("重新加载功能脚本完成...", TMsgColor.c_Green, TMsgType.t_Hint);
                }
                else
                {
                    this.SysMsg("重新加载功能脚本失败...", TMsgColor.c_Green, TMsgType.t_Hint);
                }
            }
        }

        public void CmdReloadRobot()
        {
            M2Share.RobotManage.ReLoadRobot();
            this.SysMsg("重新加载机器人配置完成...", TMsgColor.c_Green, TMsgType.t_Hint);
        }

        public void CmdReloadRobotManage()
        {
            if ((this.m_btPermission < 6))
            {
                return;
            }
            if (M2Share.g_RobotNPC != null)
            {
                M2Share.g_RobotNPC.ClearScript();
                M2Share.g_RobotNPC.LoadNpcScript();
                this.SysMsg("重新加载机器人专用脚本完成...", TMsgColor.c_Green, TMsgType.t_Hint);
            }
            else
            {
                this.SysMsg("重新加载机器人专用脚本失败...", TMsgColor.c_Green, TMsgType.t_Hint);
            }
        }

        public void CmdReloadMonItems()
        {
            int I;
            TMonInfo Monster;
            if ((this.m_btPermission < 6))
            {
                return;
            }
            try
            {
                for (I = 0; I < UserEngine.MonsterList.Count; I++)
                {
                    Monster = UserEngine.MonsterList[I];
                    LocalDB.GetInstance().LoadMonitems(Monster.sName, ref Monster.ItemList);
                }
                this.SysMsg("怪物爆物品列表重加载完成...", TMsgColor.c_Green, TMsgType.t_Hint);
            }
            catch
            {
                this.SysMsg("怪物爆物品列表重加载失败！！！", TMsgColor.c_Green, TMsgType.t_Hint);
            }
        }

        public void CmdSearchHuman(string sCmd, string sHumanName)
        {
            TPlayObject PlayObject;
            if (this.m_boProbeNecklace || (this.m_btPermission >= 6))
            {
                if ((sHumanName == ""))
                {
                    if (GameConfig.boGMShowFailMsg)
                    {
                        this.SysMsg("命令格式: @" + sCmd + " 人物名称", TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    return;
                }

                if (((HUtil32.GetTickCount() - this.m_dwProbeTick) > 10000) || (this.m_btPermission >= 3))
                {

                    this.m_dwProbeTick = HUtil32.GetTickCount();
                    PlayObject = UserEngine.GetPlayObject(sHumanName);
                    if (PlayObject != null)
                    {
                        this.SysMsg(sHumanName + " 现在位于 " + PlayObject.m_PEnvir.sMapDesc + " " + (PlayObject.m_nCurrX).ToString() + ":" + (PlayObject.m_nCurrY).ToString(), TMsgColor.c_Blue, TMsgType.t_Hint);
                    }
                    else
                    {
                        this.SysMsg(sHumanName + " 现在不在线，或位于其它服务器上！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                }
                else
                {

                    this.SysMsg(((HUtil32.GetTickCount() - this.m_dwProbeTick) / 1000 - 10).ToString() + " 秒之后才可以再使用此功能！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                }
            }
            else
            {
                this.SysMsg("您现在还无法使用此功能！！！", TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        public void CmdShowSbkGold(TGameCmd Cmd, string sCASTLENAME, string sCtr, string sGold)
        {
            int I;
            char Ctr;
            int nGold;
            TUserCastle Castle;
            List<string> List;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (((sCASTLENAME != "") && (sCASTLENAME[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, Cmd.sCmd, ""), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            if (sCASTLENAME == "")
            {
                List = new List<string>();
                M2Share.g_CastleManager.GetCastleGoldInfo(List);
                for (I = 0; I < List.Count; I++)
                {
                    this.SysMsg(List[I], TMsgColor.c_Green, TMsgType.t_Hint);
                }
                Dispose(List);
                return;
            }
            Castle = M2Share.g_CastleManager.Find(sCASTLENAME);
            if (Castle == null)
            {
                this.SysMsg(string.Format(GameMsgDef.g_sGameCommandSbkGoldCastleNotFoundMsg, new string[] { sCASTLENAME }), TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            Ctr = sCtr[0];
            nGold = HUtil32.Str_ToInt(sGold, -1);
            if (!(new ArrayList(new string[] { "=", "-", "+" }).Contains(Ctr)) || (nGold < 0) || (nGold > 100000000))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, Cmd.sCmd, GameMsgDef.g_sGameCommandSbkGoldHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            switch (Ctr)
            {
                case '=':
                    Castle.m_nTotalGold = nGold;
                    break;
                case '-':
                    Castle.m_nTotalGold -= 1;
                    break;
                case '+':
                    Castle.m_nTotalGold += nGold;
                    break;
            }
            if (Castle.m_nTotalGold < 0)
            {
                Castle.m_nTotalGold = 0;
            }
        }

        // 参数：人物名称 物品类型 绑定方法
        public unsafe void CmdBindUseItem(TGameCmd Cmd, string sHumanName, string sItem, string sType)
        {
            int I;
            TPlayObject PlayObject;
            TUserItem* UserItem = null;
            int nItem;
            int nBind;
            TItemBind ItemBind;
            int nItemIdx;
            int nMakeIdex;
            string sBindName;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            nBind = -1;
            nItem = M2Share.GetUseItemIdx(sItem);
            if ((sType).ToLower().CompareTo(("帐号").ToLower()) == 0)
            {
                nBind = 0;
            }
            if ((sType).ToLower().CompareTo(("人物").ToLower()) == 0)
            {
                nBind = 1;
            }
            if ((sType).ToLower().CompareTo(("IP").ToLower()) == 0)
            {
                nBind = 2;
            }
            if ((sType).ToLower().CompareTo(("死亡").ToLower()) == 0)
            {
                nBind = 3;
            }
            // 死亡不爆出
            if ((nItem < 0) || (nBind < 0) || (sHumanName == "") || ((sHumanName != "") && (sHumanName[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, Cmd.sCmd, GameMsgDef.g_sGameCommandBindUseItemHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumanName);
            if (PlayObject == null)
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, sHumanName), TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            UserItem = PlayObject.m_UseItems[nItem];
            if (UserItem->wIndex == 0)
            {
                this.SysMsg(string.Format(GameMsgDef.g_sGameCommandBindUseItemNoItemMsg, new string[] { sHumanName, sItem }), TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            nItemIdx = UserItem->wIndex;
            nMakeIdex = UserItem->MakeIndex;
            switch (nBind)
            {
                case 0:
                    sBindName = PlayObject.m_sUserID;
                    //M2Share.g_ItemBindAccount.__Lock();
                    try
                    {
                        for (I = 0; I < M2Share.g_ItemBindAccount.Count; I++)
                        {
                            ItemBind = M2Share.g_ItemBindAccount[I];
                            if ((ItemBind.nItemIdx == nItemIdx) && (ItemBind.nMakeIdex == nMakeIdex))
                            {
                                this.SysMsg(string.Format(GameMsgDef.g_sGameCommandBindUseItemAlreadBindMsg, new string[] { sHumanName, sItem }), TMsgColor.c_Red, TMsgType.t_Hint);
                                return;
                            }
                        }
                        ItemBind = new TItemBind();
                        ItemBind.nItemIdx = nItemIdx;
                        ItemBind.nMakeIdex = nMakeIdex;
                        ItemBind.sBindName = sBindName;
                        M2Share.g_ItemBindAccount.Insert(0, ItemBind);
                    }
                    finally
                    {
                        //M2Share.g_ItemBindAccount.UnLock();
                    }
                    M2Share.SaveItemBindAccount();

                    this.SysMsg(string.Format("%s[%s]IDX[%d]系列号[%d]持久[%d-%d]，绑定到%s成功。", M2Share.GetUseItemName(nItem), UserEngine.GetStdItemName(UserItem->wIndex), UserItem->wIndex, UserItem->MakeIndex, UserItem->Dura, UserItem->DuraMax, sBindName), TMsgColor.c_Blue, TMsgType.t_Hint);

                    PlayObject.SysMsg(string.Format("您的%s[%s]已经绑定到%s[%s]上了。", M2Share.GetUseItemName(nItem), UserEngine.GetStdItemName(UserItem->wIndex), sType, sBindName), TMsgColor.c_Blue, TMsgType.t_Hint);
                    break;
                case 1:
                    sBindName = PlayObject.m_sCharName;
                    // M2Share.g_ItemBindCharName.__Lock();
                    try
                    {
                        for (I = 0; I < M2Share.g_ItemBindCharName.Count; I++)
                        {
                            //ItemBind = M2Share.g_ItemBindCharName[I];
                            //if ((ItemBind.nItemIdx == nItemIdx) && (ItemBind.nMakeIdex == nMakeIdex))
                            //{
                            //    this.SysMsg(string.Format(M2Share.g_sGameCommandBindUseItemAlreadBindMsg, new string[] { sHumanName, sItem }), TMsgColor.c_Red, TMsgType.t_Hint);
                            //    return;
                            //}
                        }
                        ItemBind = new TItemBind();
                        ItemBind.nItemIdx = nItemIdx;
                        ItemBind.nMakeIdex = nMakeIdex;
                        ItemBind.sBindName = sBindName;
                        // M2Share.g_ItemBindCharName.InsertText(0, ItemBind);
                    }
                    finally
                    {
                        // M2Share.g_ItemBindCharName.UnLock();
                    }
                    M2Share.SaveItemBindCharName();
                    this.SysMsg(string.Format("%s[%s]IDX[%d]系列号[%d]持久[%d-%d]，绑定到%s成功。", M2Share.GetUseItemName(nItem), UserEngine.GetStdItemName(UserItem->wIndex), UserItem->wIndex, UserItem->MakeIndex, UserItem->Dura, UserItem->DuraMax, sBindName), TMsgColor.c_Blue, TMsgType.t_Hint);
                    PlayObject.SysMsg(string.Format("您的%s[%s]已经绑定到%s[%s]上了。", M2Share.GetUseItemName(nItem), UserEngine.GetStdItemName(UserItem->wIndex), sType, sBindName), TMsgColor.c_Blue, TMsgType.t_Hint);
                    break;
                case 2:
                    sBindName = PlayObject.m_sIPaddr;
                    //M2Share.g_ItemBindIPaddr.__Lock();
                    try
                    {
                        if (M2Share.g_ItemBindIPaddr.Count > 0)
                        {
                            for (I = 0; I < M2Share.g_ItemBindIPaddr.Count; I++)
                            {
                                //ItemBind = M2Share.g_ItemBindIPaddr[I];
                                //if ((ItemBind.nItemIdx == nItemIdx) && (ItemBind.nMakeIdex == nMakeIdex))
                                //{
                                //    this.SysMsg(string.Format(M2Share.g_sGameCommandBindUseItemAlreadBindMsg, new string[] { sHumanName, sItem }), TMsgColor.c_Red, TMsgType.t_Hint);
                                //    return;
                                //}
                            }
                        }
                        ItemBind = new TItemBind();
                        ItemBind.nItemIdx = nItemIdx;
                        ItemBind.nMakeIdex = nMakeIdex;
                        ItemBind.sBindName = sBindName;
                        //M2Share.g_ItemBindIPaddr.InsertText(0, ItemBind);
                    }
                    finally
                    {
                        // M2Share.g_ItemBindIPaddr.UnLock();
                    }
                    M2Share.SaveItemBindIPaddr();
                    this.SysMsg(string.Format("%s[%s]IDX[%d]系列号[%d]持久[%d-%d]，绑定到%s成功。", M2Share.GetUseItemName(nItem), UserEngine.GetStdItemName(UserItem->wIndex), UserItem->wIndex, UserItem->MakeIndex, UserItem->Dura, UserItem->DuraMax, sBindName), TMsgColor.c_Blue, TMsgType.t_Hint);
                    PlayObject.SysMsg(string.Format("您的%s[%s]已经绑定到%s[%s]上了。", M2Share.GetUseItemName(nItem), UserEngine.GetStdItemName(UserItem->wIndex), sType, sBindName), TMsgColor.c_Blue, TMsgType.t_Hint);
                    break;
                case 3:// 人物装备死亡不爆绑定
                    sBindName = PlayObject.m_sCharName;
                    //M2Share.g_ItemBindDieNoDropName.__Lock();
                    try
                    {
                        for (I = 0; I < M2Share.g_ItemBindDieNoDropName.Count; I++)
                        {
                            //ItemBind = M2Share.g_ItemBindDieNoDropName[I];
                            //if ((ItemBind.nItemIdx == nItemIdx) && (ItemBind.sBindName == sBindName))
                            //{
                            //    this.SysMsg(string.Format(M2Share.g_sGameCommandBindUseItemAlreadBindMsg, new string[] { sHumanName, sItem }), TMsgColor.c_Red, TMsgType.t_Hint);
                            //    return;
                            //}
                        }
                        ItemBind = new TItemBind();
                        ItemBind.nItemIdx = nItemIdx;
                        ItemBind.nMakeIdex = 0;
                        ItemBind.sBindName = sBindName;
                        //M2Share.g_ItemBindDieNoDropName.InsertText(0, ItemBind);
                    }
                    finally
                    {
                        // M2Share.g_ItemBindDieNoDropName.UnLock();
                    }
                    M2Share.SaveItemBindDieNoDropName();// 保存人物装备死亡不爆列表
                    this.SysMsg(string.Format("%s[%s]IDX[%d]系列号[%d]持久[%d-%d]，死亡不爆绑定到%s成功。", M2Share.GetUseItemName(nItem), UserEngine.GetStdItemName(UserItem->wIndex), UserItem->wIndex, UserItem->MakeIndex, UserItem->Dura, UserItem->DuraMax, sBindName), TMsgColor.c_Blue, TMsgType.t_Hint);
                    PlayObject.SysMsg(string.Format("您的%s[%s]已经绑定到%s[%s]上了。", M2Share.GetUseItemName(nItem), UserEngine.GetStdItemName(UserItem->wIndex), sType, sBindName), TMsgColor.c_Blue, TMsgType.t_Hint);
                    break;
            }
        }

        public void CmdShutup(TGameCmd Cmd, string sHumanName, string sTime)
        {
            uint dwTime = 0;
            int nIndex = 0;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sTime == "") || (sHumanName == "") || ((sHumanName != "") && (sHumanName[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, Cmd.sCmd, GameMsgDef.g_sGameCommandShutupHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            // dwTime = HUtil32.Str_ToInt(sTime, 5);
            // M2Share.g_DenySayMsgList.__Lock();
            try
            {
                //nIndex = M2Share.g_DenySayMsgList.GetIndex(sHumanName);
                if (nIndex >= 0)
                {
                    // 60 * 1000
                    // M2Share.g_DenySayMsgList.Values[nIndex] = ((HUtil32.GetTickCount() + dwTime * 60000) as Object);
                }
                else
                {
                    // 60 * 1000
                    // M2Share.g_DenySayMsgList.AddRecord(sHumanName, HUtil32.GetTickCount() + dwTime * 60000);
                }
            }
            finally
            {
                // M2Share.g_DenySayMsgList.UnLock();
            }
            this.SysMsg(string.Format(GameMsgDef.g_sGameCommandShutupHumanMsg, sHumanName, dwTime), TMsgColor.c_Red, TMsgType.t_Hint);
        }

        public void CmdShutupList(TGameCmd Cmd, string sParam1)
        {
            int I;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (((sParam1 != "") && (sParam1[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, new string[] { Cmd.sCmd, "" }), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            if ((this.m_btPermission < 6))
            {
                return;
            }
            lock (M2Share.g_DenySayMsgList)
                try
                {
                    if (M2Share.g_DenySayMsgList.Count <= 0)
                    {
                        this.SysMsg(GameMsgDef.g_sGameCommandShutupListIsNullMsg, TMsgColor.c_Green, TMsgType.t_Hint);
                        return;
                    }
                    for (I = 0; I < M2Share.g_DenySayMsgList.Count; I++)
                    {
                        //this.SysMsg(M2Share.g_DenySayMsgList[I] + " " + ((((uint)M2Share.g_DenySayMsgList[I]) - HUtil32.GetTickCount()) / 60000).ToString(), TMsgColor.c_Green, TMsgType.t_Hint);
                    }
                }
                finally
                {

                }
        }

        public void CmdShutupRelease(TGameCmd Cmd, string sHumanName, bool boAll)
        {
            int I;
            TPlayObject PlayObject;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sHumanName == "") || ((sHumanName != "") && (sHumanName[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, Cmd.sCmd, GameMsgDef.g_sGameCommandShutupReleaseHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            lock (M2Share.g_DenySayMsgList)
                try
                {
                    //I = M2Share.g_DenySayMsgList.IndexOf(sHumanName);
                    //if (I >= 0)
                    //{
                    //    M2Share.g_DenySayMsgList.RemoveAt(I);
                    //    PlayObject = UserEngine.GetPlayObject(sHumanName);
                    //    if (PlayObject != null)
                    //    {
                    //        PlayObject.SysMsg(M2Share.g_sGameCommandShutupReleaseCanSendMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                    //    }
                    //    if (boAll)
                    //    {
                    //        UserEngine.SendServerGroupMsg(Grobal2.SS_210, M2Share.nServerIndex, sHumanName);
                    //    }
                    //    this.SysMsg(string.Format(M2Share.g_sGameCommandShutupReleaseHumanCanSendMsg, new string[] { sHumanName }), TMsgColor.c_Green, TMsgType.t_Hint);
                    //}
                }
                finally
                {

                }
        }

        // 调整身上装备附加属性 参数16为吸伤属性  @SUPERMAKE
        public unsafe void CmdSmakeItem(TGameCmd Cmd, int nWhere, int nValueType, int nValue)
        {
            string sShowMsg;
            TStdItem* StdItem;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((nWhere >= 0 && nWhere <= 13) && (nValueType >= 0 && nValueType <= 16) && (nValue >= 0 && nValue <= 255))
            {
                if (this.m_UseItems[nWhere]->wIndex > 0)
                {
                    StdItem = UserEngine.GetStdItem(this.m_UseItems[nWhere]->wIndex);
                    if (StdItem == null)
                    {
                        return;
                    }
                    this.m_UseItems[nWhere]->btValue[9] = (byte)HUtil32._MIN(255, this.m_UseItems[nWhere]->btValue[9] + 1);// 累积升级次数
                    if ((nValueType == 16) && (StdItem->Shape == 188))// 吸伤属性
                    {
                        this.m_UseItems[nWhere]->btValue[20] = Convert.ToByte(nValue);
                        if (this.m_UseItems[nWhere]->btValue[20] > 100)
                        {
                            this.m_UseItems[nWhere]->btValue[20] = (byte)100;
                        }
                    }
                    else if ((nValueType > 13) && (nValueType < 16))
                    {
                        nValue = HUtil32._MIN(65, nValue);
                        if (nValueType == 14)
                        {
                            this.m_UseItems[nWhere]->Dura = Convert.ToUInt16(nValue * 1000);
                        }
                        if (nValueType == 15)
                        {
                            this.m_UseItems[nWhere]->DuraMax = Convert.ToUInt16(nValue * 1000);
                        }
                    }
                    else
                    {
                        this.m_UseItems[nWhere]->btValue[nValueType] = Convert.ToByte(nValue);
                    }
                    RecalcAbilitys();
                    this.CompareSuitItem(false);//套装
                    SendUpdateItem(this.m_UseItems[nWhere]);
                    if (GameConfig.boShowMakeItemMsg)
                    {
                        sShowMsg = this.m_UseItems[nWhere]->wIndex + "-" + this.m_UseItems[nWhere]->MakeIndex + " " + this.m_UseItems[nWhere]->Dura + "/" + this.m_UseItems[nWhere]->DuraMax + " " + this.m_UseItems[nWhere]->btValue[0] + "/" + this.m_UseItems[nWhere]->btValue[1] + "/"
                            + this.m_UseItems[nWhere]->btValue[2] + "/" + this.m_UseItems[nWhere]->btValue[3] + "/" + this.m_UseItems[nWhere]->btValue[4] + "/" + this.m_UseItems[nWhere]->btValue[5] + "/"
                            + this.m_UseItems[nWhere]->btValue[6] + "/" + this.m_UseItems[nWhere]->btValue[7] + "/" + this.m_UseItems[nWhere]->btValue[8] + "/" + this.m_UseItems[nWhere]->btValue[9] + "/"
                            + this.m_UseItems[nWhere]->btValue[10] + "/" + this.m_UseItems[nWhere]->btValue[11] + "/" + this.m_UseItems[nWhere]->btValue[12] + "/" + this.m_UseItems[nWhere]->btValue[13] + "/" + this.m_UseItems[nWhere]->btValue[20];
                        M2Share.MainOutMessage("[物品调整] " + this.m_sCharName + "(" + HUtil32.SBytePtrToString(StdItem->Name, StdItem->NameLen) + " -> " + sShowMsg + ")");
                    }
                }
                else
                {
                    this.SysMsg(GameMsgDef.g_sGamecommandSuperMakeHelpMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                }
            }
        }

        public void CmdSpirtStart(string sCmd, string sParam1)
        {
            int nTime;
            uint dwTime;
            if ((this.m_btPermission < 6))
            {
                return;
            }
            if ((sParam1 != "") && (sParam1[0] == '?'))
            {
                this.SysMsg("此命令用于开始祈祷生效宝宝叛变。", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            nTime = HUtil32.Str_ToInt(sParam1, -1);
            if (nTime > 0)
            {
                dwTime = (uint)nTime * 1000;
            }
            else
            {
                dwTime = GameConfig.dwSpiritMutinyTime;
            }

            M2Share.g_dwSpiritMutinyTick = HUtil32.GetTickCount() + dwTime;
            this.SysMsg("祈祷叛变已开始。持续时长 " + dwTime / 1000 + " 秒。", TMsgColor.c_Green, TMsgType.t_Hint);
        }

        public void CmdSpirtStop(string sCmd, string sParam1)
        {
            if ((this.m_btPermission < 6))
            {
                return;
            }
            if ((sParam1[0] == '?'))
            {
                this.SysMsg("此命令用于停止祈祷生效导致宝宝叛变。", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            M2Share.g_dwSpiritMutinyTick = 0;
            this.SysMsg("祈祷叛变已停止。", TMsgColor.c_Green, TMsgType.t_Hint);
        }

        public void CmdStartQuest(TGameCmd Cmd, string sQuestName)
        {
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sQuestName == ""))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("命令格式: @" + Cmd.sCmd + " 问答名称", TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            UserEngine.SendQuestMsg(sQuestName);
        }

        public void CmdSuperTing(TGameCmd Cmd, string sHumanName, string sRange)
        {
            TPlayObject PlayObject;
            TPlayObject MoveHuman;
            int nRange;
            List<TPlayObject> HumanList;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sRange == "") || (sHumanName == "") || ((sHumanName != "") && (sHumanName[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, Cmd.sCmd, GameMsgDef.g_sGameCommandSuperTingHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            nRange = HUtil32._MAX(10, HUtil32.Str_ToInt(sRange, 2));
            PlayObject = UserEngine.GetPlayObject(sHumanName);
            if (PlayObject != null)
            {
                HumanList = new List<TPlayObject>();
                UserEngine.GetMapRageHuman(PlayObject.m_PEnvir, PlayObject.m_nCurrX, PlayObject.m_nCurrY, nRange, HumanList);
                if (HumanList.Count > 0)
                {
                    for (int I = 0; I < HumanList.Count; I++)
                    {
                        MoveHuman = HumanList[I];
                        if (MoveHuman != this)
                        {
                            MoveHuman.MapRandomMove(MoveHuman.m_sHomeMap, 0);
                        }
                    }
                }
                Dispose(HumanList);
            }
            else
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, sHumanName), TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        public void CmdTakeOffHorse(string sCmd, string sParam)
        {
            if ((sParam != "") && (sParam[0] == '?'))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("下马命令，在骑马状态输入此命令下马。", TMsgColor.c_Red, TMsgType.t_Hint);
                    this.SysMsg(string.Format("命令格式: @{0}", sCmd), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            if (!this.m_boOnHorse)
            {
                return;
            }
            this.m_boOnHorse = false;
            this.FeatureChanged();
        }

        public void CmdTakeOnHorse(string sCmd, string sParam)
        {
            if ((sParam != "") && (sParam[0] == '?'))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg("上马命令，在戴好马牌后输入此命令就可以骑上马。", TMsgColor.c_Red, TMsgType.t_Hint);
                    this.SysMsg(string.Format("命令格式: @{0}", sCmd), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            if (this.m_boOnHorse)
            {
                return;
            }
            if ((this.m_btHorseType == 0))
            {
                this.SysMsg("骑马必须先戴上马牌！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            this.m_boOnHorse = true;
            this.FeatureChanged();
        }

        public void CmdTestFire(string sCmd, int nRange, int nType, int nTime, int nPoint)
        {
            int nX;
            int nY;
            TFireBurnEvent FireBurnEvent;
            int nMinX;
            int nMaxX;
            int nMinY;
            int nMaxY;
            nMinX = this.m_nCurrX - nRange;
            nMaxX = this.m_nCurrX + nRange;
            nMinY = this.m_nCurrY - nRange;
            nMaxY = this.m_nCurrY + nRange;
            for (nX = nMinX; nX <= nMaxX; nX++)
            {
                for (nY = nMinY; nY <= nMaxY; nY++)
                {
                    if (((nX < nMaxX) && (nY == nMinY)) || ((nY < nMaxY) && (nX == nMinX)) || (nX == nMaxX) || (nY == nMaxY))
                    {
                        FireBurnEvent = new TFireBurnEvent(this, nX, nY, nType, Convert.ToUInt32(nTime * 1000), nPoint);
                        M2Share.g_EventManager.AddEvent(FireBurnEvent);
                    }
                }
            }
        }

        public void CmdTestGetBagItems(TGameCmd Cmd, string sParam)
        {
            byte btDc;
            byte btSc;
            byte btMc;
            byte btDura;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sParam != "") && (sParam[0] == '?'))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, Cmd.sCmd, GameMsgDef.g_sGameCommandTestGetBagItemsHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            btDc = 0;
            btSc = 0;
            btMc = 0;
            btDura = 0;
            GetBagUseItems(ref btDc, ref btSc, ref btMc, ref btDura);
            this.SysMsg(string.Format("DC:%d SC:%d MC:%d DURA:%d", new byte[] { btDc, btSc, btMc, btDura }), TMsgColor.c_Blue, TMsgType.t_Hint);
        }

        public void CmdTestSpeedMode(TGameCmd Cmd)
        {
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            m_boTestSpeedMode = !m_boTestSpeedMode;
            if (m_boTestSpeedMode)
            {
                this.SysMsg("开启速度测试模式", TMsgColor.c_Red, TMsgType.t_Hint);
            }
            else
            {
                this.SysMsg("关闭速度测试模式", TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        public void CmdTestStatus(string sCmd, int nType, int nTime)
        {
            if ((this.m_btPermission < 6))
            {
                return;
            }
            //if ((!(nType >= Grobal2.ushort.GetLowerBound(0) && nType<= Grobal2.ushort.GetUpperBound(0))) || (nTime < 0))
            //{
            //    if (GameConfig.boGMShowFailMsg)
            //    {
            //        this.SysMsg("命令格式: @" + sCmd + " 类型(0..11) 时长", TMsgColor.c_Red, TMsgType.t_Hint);
            //    }
            //    return;
            //}
            this.m_wStatusTimeArr[nType] = Convert.ToByte(nTime * 1000);
            this.m_dwStatusArrTick[nType] = HUtil32.GetTickCount();
            this.m_nCharStatus = this.GetCharStatus();
            this.StatusChanged("");
            this.SysMsg(string.Format("状态编号:{0} 时间长度: {1} 秒", nType, nTime), TMsgColor.c_Green, TMsgType.t_Hint);
        }

        public unsafe void CmdUserMoveXY(string sCmd, string sX, string sY)
        {
            int nX;
            int nY;
            if (this.m_boTeleport)// 传送戒指
            {
                nX = HUtil32.Str_ToInt(sX, -1);
                nY = HUtil32.Str_ToInt(sY, -1);
                if (!this.m_PEnvir.m_boNOPOSITIONMOVE)
                {
                    if (this.m_PEnvir.CanWalkOfItem(nX, nY, GameConfig.boUserMoveCanDupObj, GameConfig.boUserMoveCanOnItem))
                    {
                        if ((HUtil32.GetTickCount() - this.m_dwTeleportTick) > GameConfig.dwUserMoveTime * 1000)// 10000
                        {
                            this.m_dwTeleportTick = HUtil32.GetTickCount();
                            if ((this.m_UseItems[TPosition.U_BUJUK]->wIndex > 0) && (this.m_UseItems[TPosition.U_BUJUK]->Dura > 0))
                            {
                                if (this.m_UseItems[TPosition.U_BUJUK]->Dura > 100)// 增加传送符功能
                                {
                                    this.m_UseItems[TPosition.U_BUJUK]->Dura -= 100;
                                }
                                else
                                {
                                    SendDelItems(this.m_UseItems[TPosition.U_BUJUK]);  // 如果使用完，则删除物品
                                    this.m_UseItems[TPosition.U_BUJUK]->Dura = 0;
                                    this.m_UseItems[TPosition.U_BUJUK]->wIndex = 0;
                                }
                                this.SendMsg(this, Grobal2.RM_DURACHANGE, TPosition.U_BUJUK, this.m_UseItems[TPosition.U_BUJUK]->Dura, this.m_UseItems[TPosition.U_BUJUK]->DuraMax, 0, "");
                                this.SendRefMsg(Grobal2.RM_SPACEMOVE_FIRE, 0, 0, 0, 0, "");
                                if ((nX < 0) || (nY < 0))
                                {
                                    RandomMove();
                                }
                                else
                                {
                                    this.SpaceMove(this.m_sMapName, nX, nY, 0);
                                }
                                return;
                            }
                            this.SendRefMsg(Grobal2.RM_SPACEMOVE_FIRE, 0, 0, 0, 0, "");
                            if ((nX < 0) || (nY < 0))
                            {
                                RandomMove();
                            }
                            else
                            {
                                this.SpaceMove(this.m_sMapName, nX, nY, 0);
                            }
                        }
                        else
                        {
                            this.SysMsg(GameConfig.dwUserMoveTime - (HUtil32.GetTickCount() - this.m_dwTeleportTick) / 1000 + "秒之后才可以再使用此功能！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                    }
                    else
                    {
                        this.SysMsg(string.Format(GameMsgDef.g_sGameCommandPositionMoveCanotMoveToMap, this.m_sMapName, sX, sY), TMsgColor.c_Green, TMsgType.t_Hint);
                    }
                }
                else
                {
                    this.SysMsg("此地图禁止使用此命令！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                }
            }
            else
            {
                this.SysMsg("您现在还无法使用此功能！！！", TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        public void CmdViewWhisper(TGameCmd Cmd, string sCharName, string sParam2)
        {
            TPlayObject PlayObject;
            if ((this.m_btPermission < Cmd.nPermissionMin))
            {
                this.SysMsg(GameMsgDef.g_sGameCommandPermissionTooLow, TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if ((sCharName == "") || ((sCharName != "") && (sCharName[0] == '?')))
            {
                if (GameConfig.boGMShowFailMsg)
                {
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandParamUnKnow, Cmd.sCmd, GameMsgDef.g_sGameCommandViewWhisperHelpMsg), TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sCharName);
            if (PlayObject != null)
            {
                if (PlayObject.m_GetWhisperHuman == this)
                {
                    PlayObject.m_GetWhisperHuman = null;
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandViewWhisperMsg1, sCharName), TMsgColor.c_Green, TMsgType.t_Hint);
                }
                else
                {
                    PlayObject.m_GetWhisperHuman = this;
                    this.SysMsg(string.Format(GameMsgDef.g_sGameCommandViewWhisperMsg2, sCharName), TMsgColor.c_Green, TMsgType.t_Hint);
                }
            }
            else
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, sCharName), TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        // 元宝寄售取消出售
        public void SellOffCancel()
        {
            this.SendMsg(this, Grobal2.RM_SELLOFFCANCEL, 0, 0, 0, 0, "");
            GetBackSellOffItems();
        }

        /// <summary>
        /// 交易取消
        /// </summary>
        public void DealCancel()
        {
            if (!m_boDealing)
            {
                return;
            }
            m_boDealing = false;
            SendDefMessage(Grobal2.SM_DEALCANCEL, 0, 0, 0, 0, "");
            if (m_DealCreat != null)
            {
                m_DealCreat.DealCancel();
            }
            m_DealCreat = null;
            GetBackDealItems();// '交易取消'
            this.SysMsg(GameMsgDef.g_sDealActionCancelMsg, TMsgColor.c_Green, TMsgType.t_Hint);
            m_DealLastTick = HUtil32.GetTickCount();
        }

        public void DealCancelA()
        {
            this.m_Abil.HP = this.m_WAbil.HP;
            DealCancel();
        }

        /// <summary>
        /// 减游戏币
        /// </summary>
        /// <param name="nGold"></param>
        /// <returns></returns>
        public bool DecGold(int nGold)
        {
            bool result = false;
            if (this.m_nGold >= nGold)
            {
                this.m_nGold -= nGold;
                result = true;
            }
            return result;
        }

        /// <summary>
        /// 减游戏点
        /// </summary>
        /// <param name="nGameGold"></param>
        public void DecGameGold(int nGameGold)
        {
            if (m_nGameGold >= nGameGold)
            {
                m_nGameGold -= nGameGold;
            }
            else
            {
                m_nGameGold = 0;
            }
        }

        /// <summary>
        /// 减游戏点
        /// </summary>
        /// <param name="nGamePoint"></param>
        public void DecGamePoint(int nGamePoint)
        {
            if (m_nGamePoint >= nGamePoint)
            {
                m_nGamePoint -= (UInt16)nGamePoint;
            }
            else
            {
                m_nGamePoint = 0;
            }
        }

        // 取备份元宝寄信列表物品
        public override void Disappear()
        {
            if (m_boReadyRun)
            {
                this.DisappearA();
            }
            if (this.m_boTransparent && this.m_boHideMode)
            {
                this.m_wStatusTimeArr[Grobal2.STATE_TRANSPARENT] = 0;
            }
            if (m_GroupOwner != null)
            {
                m_GroupOwner.DelMember(this);
            }
            if (this.m_MyGuild != null)
            {
                this.m_MyGuild.DelHumanObj(this);
            }
            LogonTimcCost();
            base.Disappear();
        }

        /// <summary>
        /// 人物掉落装备物品
        /// </summary>
        /// <param name="BaseObject"></param>
        public unsafe override void DropUseItems(TBaseObject BaseObject)
        {
            int nRate;
            TStdItem* StdItem;
            List<string> DelList = null;
            byte nCode = 0;
            const string sExceptionMsg = "{异常} TPlayObject::DropUseItems Code:";
            m_boCanQueryBag = true;// 掉落装备物品时,不能刷新包裹
            try
            {
                try
                {
                    if (this.m_PEnvir.m_boNODROPITEM) // 地图禁止死亡掉物品则退出
                    {
                        return;
                    }
                    nCode = 1;
                    if (this.m_boAngryRing || this.m_boNoDropUseItem)
                    {
                        return;
                    }
                    nCode = 2;
                    for (int I = m_UseItems.GetLowerBound(0); I <= m_UseItems.GetUpperBound(0); I++)
                    {
                        nCode = 3;
                        StdItem = UserEngine.GetStdItem(this.m_UseItems[I]->wIndex);
                        nCode = 4;
                        if (StdItem != null)
                        {

                            nCode = 5;
                            if (this.CheckItemValue(this.m_UseItems[I], 5)) // 禁止爆出
                            {
                                continue;
                            }
                            if (this.PlugOfCheckCanItem(6, HUtil32.SBytePtrToString(StdItem->Name, StdItem->NameLen), false, 0, 0)) // 禁止物品规则(永不爆出)
                            {
                                continue;
                            }
                            if (CheckItemBindDieNoDrop(this.m_UseItems[I]))// 人物装备绑定死亡不爆
                            {
                                continue;
                            }
                            nCode = 7;
                            if (Convert.ToInt32(StdItem->Reserved & 8) != 0)
                            {
                                nCode = 8;
                                if (DelList == null)
                                {
                                    DelList = new List<string>();
                                }
                                nCode = 9;
                                // DelList.AddObject('', TObject(m_UseItems[I]->MakeIndex));
                                if (this.m_UseItems[I]->wIndex > 0)//增加
                                {
                                    //DelList.Add(UserEngine.GetStdItemName(this.m_UseItems[I]->wIndex), ((this.m_UseItems[I]->MakeIndex) as Object));
                                }
                                nCode = 18;
                                if (StdItem->NeedIdentify == 1)
                                {
                                    M2Share.AddGameDataLog("16" + "\09" + this.m_sMapName + "(" + (this.m_btRaceServer).ToString() + ")" + "\09" + (this.m_nCurrX).ToString() + "\09" + (this.m_nCurrY).ToString() + "\09" + this.m_sCharName + "\09" +
                                        HUtil32.SBytePtrToString(StdItem->Name, StdItem->NameLen) + "\09" + (this.m_UseItems[I]->MakeIndex).ToString() + "\09" + "(" + (HUtil32.LoWord(StdItem->DC)).ToString() +
                                        "/" + (HUtil32.HiWord(StdItem->DC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MC)).ToString() + "/" + (HUtil32.HiWord(StdItem->MC)).ToString() + ")" +
                                        "(" + (HUtil32.LoWord(StdItem->SC)).ToString() + "/" + (HUtil32.HiWord(StdItem->SC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->AC)).ToString() + "/"
                                        + (HUtil32.HiWord(StdItem->AC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MAC)).ToString() + "/" + (HUtil32.HiWord(StdItem->MAC)).ToString() + ")" +
                                        (this.m_UseItems[I]->btValue[0]).ToString() + "/" + (this.m_UseItems[I]->btValue[1]).ToString() + "/" + (this.m_UseItems[I]->btValue[2]).ToString()
                                        + "/" + (this.m_UseItems[I]->btValue[3]).ToString() + "/" + (this.m_UseItems[I]->btValue[4]).ToString() + "/" +
                                        (this.m_UseItems[I]->btValue[5]).ToString() + "/" + (this.m_UseItems[I]->btValue[6]).ToString() + "/" + (this.m_UseItems[I]->btValue[7]).ToString()
                                        + "/" + (this.m_UseItems[I]->btValue[8]).ToString() + "/" + (this.m_UseItems[I]->btValue[14]).ToString() + "\09" + "0");
                                }
                                nCode = 19;
                                if (StdItem->Shape >= 126 && StdItem->Shape <= 129)// 祈祷装备,被怪(不是宝宝)打死,装备才消失,其它打死不消失
                                {
                                    nCode = 20;
                                    if (this.m_LastHiter != null)
                                    {
                                        nCode = 21;
                                        if ((this.m_LastHiter.m_btRaceServer != Grobal2.RC_PLAYOBJECT) && (this.m_LastHiter.m_Master == null))
                                        {
                                            this.m_UseItems[I]->wIndex = 0;
                                        }
                                        else
                                        {
                                            continue;
                                        }
                                    }
                                }
                                else
                                {
                                    this.m_UseItems[I]->wIndex = 0;
                                }
                            }
                        }
                    }
                    nCode = 10;
                    if (this.PKLevel() > 2)// 15
                    {

                        nRate = GameConfig.nDieRedDropUseItemRate;
                    }
                    else // 30
                    {
                        nRate = GameConfig.nDieDropUseItemRate;
                    }
                    nCode = 11;
                    for (int I = m_UseItems.GetLowerBound(0); I <= m_UseItems.GetUpperBound(0); I++)
                    {
                        nCode = 12;
                        if (HUtil32.Random(nRate) != 0)
                        {
                            continue;
                        }
                        StdItem = UserEngine.GetStdItem(this.m_UseItems[I]->wIndex);
                        nCode = 13;
                        if (M2Share.InDisableTakeOffList(this.m_UseItems[I]->wIndex))   // 检查是否在禁止取下列表,如果在列表中则不掉此物品
                        {
                            continue;
                        }
                        if (this.CheckItemValue(this.m_UseItems[I], 5))// 禁止爆出
                        {
                            continue;
                        }
                        if (StdItem != null)
                        {
                            if (this.PlugOfCheckCanItem(6, HUtil32.SBytePtrToString(StdItem->Name, StdItem->NameLen), false, 0, 0))// 禁止物品规则(永不爆出)
                            {
                                continue;
                            }
                        }
                        if (CheckItemBindDieNoDrop(this.m_UseItems[I]))    // 人物装备绑定死亡不爆
                        {
                            continue;
                        }
                        nCode = 15;
                        if (this.DropItemDown(this.m_UseItems[I], 3, true, true, BaseObject, this)) // 爆出装备
                        {
                            nCode = 16;
                            if (StdItem != null)
                            {
                                if (Convert.ToInt32(StdItem->Reserved & 10) == 0)
                                {
                                    if (this.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                                    {
                                        nCode = 17;
                                        if (DelList == null)
                                        {
                                            DelList = new List<string>();
                                        }
                                        //DelList.Add(UserEngine.GetStdItemName(this.m_UseItems[I]->wIndex), ((this.m_UseItems[I]->MakeIndex) as Object));
                                    }
                                    this.m_UseItems[I]->wIndex = 0;
                                }
                            }
                        }
                    }
                    if (DelList != null)
                    {
                        this.SendMsg(this, Grobal2.RM_SENDDELITEMLIST, 0, DelList.ToInt(), 0, 0, "");
                    }
                }
                catch
                {
                    M2Share.MainOutMessage(sExceptionMsg + nCode);
                }
            }
            finally
            {
                m_boCanQueryBag = false;// 掉落装备物品时,不能刷新包裹
            }
        }

        // nCode 1-内功怪
        public void GainExp(UInt32 dwExp, byte nCode)
        {
            int I;
            int n;
            int sumlv;
            int nExp;
            int nHighLevel;
            int nLowLevel;
            TPlayObject PlayObject;
            int nCheckCode;
            const string sExceptionMsg = "{异常} TPlayObject::GainExp Code:";
            double[] bonus = { 1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2 };
            nCheckCode = 0;
            if (this == null)
            {
                return;
            }
            try
            {
                nHighLevel = 0;
                nLowLevel = ushort.MaxValue;
                if (dwExp > 0)
                {
                    nCheckCode = 15;
                    if ((m_GroupOwner != null))
                    {
                        nCheckCode = 9;
                        if ((m_GroupOwner.m_GroupMembers != null))
                        {
                            nCheckCode = 10;
                            if ((m_GroupOwner.m_GroupMembers.Count > 0))
                            {
                                sumlv = 0;
                                n = 0;
                                nCheckCode = 1;
                                for (I = 0; I < m_GroupOwner.m_GroupMembers.Count; I++)
                                {
                                    PlayObject = m_GroupOwner.m_GroupMembers[I];
                                    if (PlayObject != null)
                                    {
                                        if (!PlayObject.m_boDeath && (this.m_PEnvir == PlayObject.m_PEnvir) && (Math.Abs(this.m_nCurrX - PlayObject.m_nCurrX) <= 12) && (Math.Abs(this.m_nCurrX - PlayObject.m_nCurrX) <= 12))
                                        {
                                            sumlv = sumlv + PlayObject.m_Abil.Level;
                                            if (PlayObject.m_Abil.Level > nHighLevel)
                                            {
                                                nHighLevel = PlayObject.m_Abil.Level;
                                            }
                                            if (PlayObject.m_Abil.Level < nLowLevel)
                                            {
                                                nLowLevel = PlayObject.m_Abil.Level;
                                            }
                                            n++;
                                        }
                                    }
                                }
                                nCheckCode = 2;
                                if ((sumlv > 0) && (n > 1))
                                {
                                    if (n >= 0 && n <= Grobal2.GROUPMAX)
                                    {
                                        dwExp = (uint)HUtil32.Round(dwExp * bonus[n]);
                                    }
                                    nCheckCode = 3;
                                    if (m_GroupOwner.m_GroupMembers.Count > 0)
                                    {
                                        for (I = 0; I < m_GroupOwner.m_GroupMembers.Count; I++)
                                        {
                                            PlayObject = m_GroupOwner.m_GroupMembers[I];
                                            if (PlayObject != null)
                                            {
                                                if (!PlayObject.m_boDeath && (this.m_PEnvir == PlayObject.m_PEnvir) && (Math.Abs(this.m_nCurrX - PlayObject.m_nCurrX) <= 12) && (Math.Abs(this.m_nCurrX - PlayObject.m_nCurrX) <= 12))
                                                {
                                                    if (GameConfig.boHighLevelKillMonFixExp && GameConfig.boHighLevelGroupFixExp)//在高等级经验不变时，把组队的经验平均分配
                                                    {
                                                        nCheckCode = 4;
                                                        PlayObject.WinExp((UInt32)HUtil32.Round((double)Convert.ToDouble(dwExp / n)));
                                                        nCheckCode = 5;
                                                        if (nCode == 1)
                                                        {
                                                            PlayObject.GetNGExp((UInt32)HUtil32.Round((double)Convert.ToDouble(dwExp / n)), 0); // 取得内力经验
                                                        }
                                                    }
                                                    else if (GameConfig.boHighLevelGroupFixExp)
                                                    {
                                                        nCheckCode = 6;
                                                        PlayObject.WinExp((UInt32)HUtil32.Round((double)dwExp / sumlv * PlayObject.m_Abil.Level));
                                                        nCheckCode = 7;
                                                        if (nCode == 1)
                                                        {
                                                            PlayObject.GetNGExp((UInt32)HUtil32.Round((double)dwExp / sumlv * PlayObject.m_Abil.Level), 0);  // 取得内力经验
                                                        }
                                                    }
                                                    else if (this.m_Abil.Level > (nLowLevel + 10))  // 大号杀怪组里人经验不变
                                                    {
                                                        PlayObject.WinExp((UInt32)HUtil32.Round((double)dwExp / sumlv * PlayObject.m_Abil.Level));
                                                        if (nCode == 1)
                                                        {
                                                            PlayObject.GetNGExp((UInt32)HUtil32.Round((double)dwExp / sumlv * PlayObject.m_Abil.Level), 0); // 取得内力经验
                                                        }
                                                    }
                                                    else if (this.m_Abil.Level <= (nLowLevel + 10))
                                                    {
                                                        if (PlayObject.m_Abil.Level > (nLowLevel + 10)) // 小号杀怪经验组里人大号经验改变
                                                        {
                                                            nExp = (int)HUtil32.Round((double)Convert.ToDouble(dwExp / PlayObject.m_Abil.Level));
                                                            if (nExp <= 0)
                                                            {
                                                                nExp = 1;
                                                            }
                                                            PlayObject.WinExp((UInt32)nExp);
                                                            if (nCode == 1)
                                                            {
                                                                PlayObject.GetNGExp((UInt32)nExp, 0);// 取得内力经验
                                                            }
                                                        }
                                                        else
                                                        {
                                                            PlayObject.WinExp((UInt32)HUtil32.Round((double)dwExp / sumlv * PlayObject.m_Abil.Level));// 小号杀怪经验组里人小号经验不变
                                                            if (nCode == 1)
                                                            {
                                                                PlayObject.GetNGExp((UInt32)HUtil32.Round((double)dwExp / sumlv * PlayObject.m_Abil.Level), 0);// 取得内力经验
                                                            }

                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    nCheckCode = 11;
                                    WinExp(dwExp);
                                    if (nCode == 1)
                                    {
                                        GetNGExp(dwExp, 0);  // 取得内力经验 
                                    }
                                }
                            }
                            else
                            {
                                nCheckCode = 12;
                                WinExp(dwExp);
                                if (nCode == 1)
                                {
                                    GetNGExp(dwExp, 0); // 取得内力经验
                                }
                            }
                        }
                        else
                        {
                            nCheckCode = 13;
                            WinExp(dwExp);
                            if (nCode == 1)
                            {
                                GetNGExp(dwExp, 0);// 取得内力经验
                            }
                        }
                    }
                    else
                    {
                        nCheckCode = 14;
                        WinExp(dwExp);
                        if (nCode == 1)
                        {
                            GetNGExp(dwExp, 0);// 取得内力经验
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage(sExceptionMsg + nCheckCode);
            }
        }

        // PK死亡
        public void GameTimeChanged()
        {
            if (m_nBright != M2Share.g_nGameTime)
            {
                m_nBright = M2Share.g_nGameTime;
                this.SendMsg(this, Grobal2.RM_DAYCHANGING, 0, 0, 0, 0, "");
            }
        }

        /// <summary>
        /// 取备份元宝寄售列表物品
        /// </summary>
        public unsafe void GetBackSellOffItems()
        {
            TUserItem* UserItem = null;
            if (m_SellOffItemList.Count > 0)
            {
                for (int I = m_SellOffItemList.Count - 1; I >= 0; I--)
                {
                    //UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                    UserItem = (TUserItem*)m_SellOffItemList[I];
                    this.m_ItemList.Add((IntPtr)UserItem);
                    m_SellOffItemList.RemoveAt(I);
                }
            }
            m_boSellOffOK = false;// 确认元宝寄售标志
        }

        public void GetBackDealItems()
        {
            if (m_DealItemList.Count > 0)
            {
                for (int I = 0; I < m_DealItemList.Count; I++)
                {
                    this.m_ItemList.Add((IntPtr)m_DealItemList[I]);
                }
            }
            m_DealItemList.Clear();
            this.m_nGold += m_nDealGolds;
            m_nDealGolds = 0;
            m_boDealOK = false;
        }

        /// <summary>
        /// 获取包裹使用物品
        /// </summary>
        /// <param name="btDc"></param>
        /// <param name="btSc"></param>
        /// <param name="btMc"></param>
        /// <param name="btDura"></param>
        public unsafe void GetBagUseItems(ref byte btDc, ref byte btSc, ref byte btMc, ref byte btDura)
        {
            ArrayList DuraList;
            TUserItem* UserItem;
            TStdItem* StdItem;
            TStdItem* StdItem80;
            List<string> DelItemList;
            int nDc;
            int nSc;
            int nMc;
            int nDcMin;
            int nDcMax;
            int nScMin;
            int nScMax;
            int nMcMin;
            int nMcMax;
            int nDura;
            int nItemCount;
            nDcMin = 0;
            nDcMax = 0;
            nScMin = 0;
            nScMax = 0;
            nMcMin = 0;
            nMcMax = 0;
            nDura = 0;
            nItemCount = 0;
            DelItemList = null;
            DuraList = new ArrayList();
            for (int I = this.m_ItemList.Count - 1; I >= 0; I--)
            {
                if (this.m_ItemList.Count <= 0)
                {
                    break;
                }
                UserItem = (TUserItem*)this.m_ItemList[I];
                if (UserItem == null)
                {
                    continue;
                }
                if (UserEngine.GetStdItemName(UserItem->wIndex) == GameConfig.sBlackStone)
                {
                    DuraList.Add((HUtil32.Round(UserItem->Dura / 1.0E3) as object));
                    if (DelItemList == null)
                    {
                        DelItemList = new List<string>();
                    }
                    //DelItemList.Add(GameConfig.sBlackStone, ((UserItem->MakeIndex) as Object));
                    Marshal.FreeHGlobal((IntPtr)UserItem);
                    this.m_ItemList.RemoveAt(I);
                }
                else
                {
                    if (M2Share.IsUseItem(UserItem->wIndex))
                    {
                        StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                        if (StdItem != null)
                        {
                            StdItem80 = StdItem;
                            ItemUnit.GetItemAddValue(UserItem, StdItem80);
                            nDc = 0;
                            nSc = 0;
                            nMc = 0;
                            switch (StdItem80->StdMode)
                            {
                                case 19:
                                case 20:
                                case 21:
                                    nDc = HUtil32.HiWord(StdItem80->DC) + HUtil32.LoWord(StdItem80->DC);
                                    nSc = HUtil32.HiWord(StdItem80->SC) + HUtil32.LoWord(StdItem80->SC);
                                    nMc = HUtil32.HiWord(StdItem80->MC) + HUtil32.LoWord(StdItem80->MC);
                                    break;
                                case 22:
                                case 23:
                                    nDc = HUtil32.HiWord(StdItem80->DC) + HUtil32.LoWord(StdItem80->DC);
                                    nSc = HUtil32.HiWord(StdItem80->SC) + HUtil32.LoWord(StdItem80->SC);
                                    nMc = HUtil32.HiWord(StdItem80->MC) + HUtil32.LoWord(StdItem80->MC);
                                    break;
                                case 24:
                                case 26:
                                    nDc = HUtil32.HiWord(StdItem80->DC) + HUtil32.LoWord(StdItem80->DC) + 1;
                                    nSc = HUtil32.HiWord(StdItem80->SC) + HUtil32.LoWord(StdItem80->SC) + 1;
                                    nMc = HUtil32.HiWord(StdItem80->MC) + HUtil32.LoWord(StdItem80->MC) + 1;
                                    break;
                            }
                            if (nDcMin < nDc)
                            {
                                nDcMax = nDcMin;
                                nDcMin = nDc;
                            }
                            else
                            {
                                if (nDcMax < nDc)
                                {
                                    nDcMax = nDc;
                                }
                            }
                            if (nScMin < nSc)
                            {
                                nScMax = nScMin;
                                nScMin = nSc;
                            }
                            else
                            {
                                if (nScMax < nSc)
                                {
                                    nScMax = nSc;
                                }
                            }
                            if (nMcMin < nMc)
                            {
                                nMcMax = nMcMin;
                                nMcMin = nMc;
                            }
                            else
                            {
                                if (nMcMax < nMc)
                                {
                                    nMcMax = nMc;
                                }
                            }
                            if (DelItemList == null)
                            {
                                DelItemList = new List<string>();
                            }
                            //DelItemList.Add(HUtil32.SBytePtrToString(HUtil32.SBytePtrToString(StdItem->Name, StdItem->NameLen),0,HUtil32.SBytePtrToString(StdItem->Name, StdItem->NameLen)Len), ((UserItem->MakeIndex) as Object));
                            if (StdItem->NeedIdentify == 1)
                            {
                                M2Share.AddGameDataLog("26" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString() + "\09"
                                    + (this.m_nCurrY).ToString() + "\09" + this.m_sCharName + "\09" + HUtil32.SBytePtrToString(StdItem->Name, StdItem->NameLen) + "\09" + (UserItem->MakeIndex).ToString()
                                    + "\09" + "(" + (HUtil32.LoWord(StdItem->DC)).ToString() + "/" + (HUtil32.HiWord(StdItem->DC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MC)).ToString()
                                    + "/" + (HUtil32.HiWord(StdItem->MC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->SC)).ToString() + "/" + (HUtil32.HiWord(StdItem->SC)).ToString() + ")"
                                    + "(" + (HUtil32.LoWord(StdItem->AC)).ToString() + "/" + (HUtil32.HiWord(StdItem->AC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MAC)).ToString() + "/"
                                    + (HUtil32.HiWord(StdItem->MAC)).ToString() + ")" + (UserItem->btValue[0]).ToString() + "/" + (UserItem->btValue[1]).ToString() + "/"
                                    + (UserItem->btValue[2]).ToString() + "/" + (UserItem->btValue[3]).ToString() + "/" + (UserItem->btValue[4]).ToString() + "/"
                                    + (UserItem->btValue[5]).ToString() + "/" + (UserItem->btValue[6]).ToString() + "/" + (UserItem->btValue[7]).ToString() + "/"
                                    + (UserItem->btValue[8]).ToString() + "/" + (UserItem->btValue[14]).ToString() + "\09" + "0");
                            }
                            UserItem = null;
                            this.m_ItemList.RemoveAt(I);
                        }
                    }
                }
            }
            if (DuraList.Count > 0)
            {
                for (int I = 0; I < DuraList.Count; I++)
                {
                    if (DuraList.Count <= 0)
                    {
                        break;
                    }
                    for (int II = DuraList.Count - 1; II > I; II--)
                    {
                        //if (((int)DuraList[II]) > ((int)DuraList[II - 1]))
                        //{
                        //    DuraList.Exchange(II, II - 1);
                        //}
                    }
                }
                for (int I = 0; I < DuraList.Count; I++)
                {
                    nDura = nDura + ((int)DuraList[I]);
                    nItemCount++;
                    if (nItemCount >= 5)
                    {
                        break;
                    }
                }
            }
            btDura = (byte)HUtil32.Round((double)HUtil32._MIN(5, nItemCount) + HUtil32._MIN(5, nItemCount) * ((nDura / nItemCount) / 5.0));
            btDc = Convert.ToByte(nDcMin / 5 + nDcMax / 3);
            btSc = Convert.ToByte(nScMin / 5 + nScMax / 3);
            btMc = Convert.ToByte(nMcMin / 5 + nMcMax / 3);
            if (DelItemList != null)
            {
                this.SendMsg(this, Grobal2.RM_SENDDELITEMLIST, 0, DelItemList.ToInt(), 0, 0, "");
            }
            if (DuraList != null)
            {
                Dispose(DuraList);
            }
        }

        public override string GeTBaseObjectInfo()
        {
            string result = string.Empty;
            result = this.m_sCharName + " 标识:" + this.ToInt() + " 权限等级: " + (this.m_btPermission).ToString() + " 管理模式: "
            + HUtil32.BoolToCStr(this.m_boAdminMode) + " 隐身模式: " + HUtil32.BoolToCStr(this.m_boObMode) + " 无敌模式: " + HUtil32.BoolToCStr(this.m_boSuperMan)
                + " 地图:" + this.m_sMapName + "(" + this.m_PEnvir.sMapDesc + ")" + " 座标:" + (this.m_nCurrX).ToString() + ":" + (this.m_nCurrY).ToString() + " 等级:"
                + (this.m_Abil.Level).ToString() + " 转生等级:" + (m_btReLevel).ToString() + " 经验:" + (this.m_Abil.Exp).ToString() + " 生命值: " + (this.m_WAbil.HP).ToString()
                + "-" + (this.m_WAbil.MaxHP).ToString() + " 魔法值: " + (this.m_WAbil.MP).ToString() + "-" + (this.m_WAbil.MaxMP).ToString() + " 攻击力: "
                + (HUtil32.LoWord(this.m_WAbil.DC)).ToString() + "-" + (HUtil32.HiWord(this.m_WAbil.DC)).ToString() + " 魔法力: " + (HUtil32.LoWord(this.m_WAbil.MC)).ToString()
                + "-" + (HUtil32.HiWord(this.m_WAbil.MC)).ToString() + " 道术: " + (HUtil32.LoWord(this.m_WAbil.SC)).ToString() + "-" + (HUtil32.HiWord(this.m_WAbil.SC)).ToString()
                + " 防御力: " + (HUtil32.LoWord(this.m_WAbil.AC)).ToString() + "-" + (HUtil32.HiWord(this.m_WAbil.AC)).ToString() + " 魔防力: "
                + (HUtil32.LoWord(this.m_WAbil.MAC)).ToString() + "-" + (HUtil32.HiWord(this.m_WAbil.MAC)).ToString() + " 准确:" + (this.m_btHitPoint).ToString() + " 敏捷:"
                + (this.m_btSpeedPoint).ToString() + " 速度:" + (this.m_nHitSpeed).ToString() + " 仓库密码:" + m_sStoragePwd + " 登录IP:" + m_sIPaddr + "(" + m_sIPLocal + ")"
                + " 登录帐号:" + m_sUserID + " 登录时间:" + (m_dLogonTime).ToString() + " 在线时长(分钟):" + ((HUtil32.GetTickCount() - m_dwLogonTick) / 60000).ToString()
                + " 登录模式:" + (m_nPayMent).ToString() + " " + GameConfig.sGameGoldName + ":" + (m_nGameGold).ToString() + " " + GameConfig.sGameDiaMond + ":"
                + (m_nGAMEDIAMOND).ToString() + " " + GameConfig.sGameGird + ":" + (m_nGAMEGIRD).ToString() + " " + GameConfig.sGamePointName + ":"
                + (m_nGamePoint).ToString()
                + " " + GameConfig.sPayMentPointName + ":" + (m_nPayMentPoint).ToString() + " 会员类型:" + (m_nMemberType).ToString() + " 会员等级:"
                + (m_nMemberLevel).ToString() + " 经验倍数:" + (m_nKillMonExpRate / 100).ToString() + " 攻击倍数:" + (m_nPowerRate / 100).ToString() + " 声望值:"
                + (m_btCreditPoint).ToString();
            return result;
        }

        public unsafe int GetDigUpMsgCount()
        {
            int result = 0;
            TSendMessage SendMessage = null;
            try
            {
                HUtil32.EnterCriticalSection(M2Share.ProcessMsgCriticalSection);
                if (this.m_MsgList.Count > 0)
                {
                    for (int I = 0; I < this.m_MsgList.Count; I++)
                    {
                        SendMessage = this.m_MsgList[I];
                        if (SendMessage != null)
                        {
                            if ((SendMessage.wIdent == Grobal2.CM_BUTCH))
                            {
                                result++;
                            }
                        }
                    }
                }
            }
            finally
            {
                HUtil32.LeaveCriticalSection(M2Share.ProcessMsgCriticalSection);
            }
            return result;
        }

        /// <summary>
        /// 客户端查询包裹物品
        /// </summary>
        public unsafe void ClientQueryBagItems()
        {
            TStdItem* Item;
            string sSENDMSG;
            TClientItem* ClientItem = null;
            TOClientItem* OClientItem = null;
            TStdItem* StdItem = null;
            TUserItem* UserItem = null;
            string sUserItemName;
            if (m_boCanQueryBag) // 是否可以刷新包裹
            {
                return;
            }
            m_boCanQueryBag = true;
            try
            {
                if (m_nSoftVersionDateEx == 0)
                {
                    sSENDMSG = "";
                    if (this.m_ItemList.Count > 0)
                    {
                        for (int I = 0; I < this.m_ItemList.Count; I++)
                        {
                            UserItem = (TUserItem*)this.m_ItemList[I];
                            if (UserItem != null)
                            {
                                Item = UserEngine.GetStdItem(UserItem->wIndex);
                                if (Item != null)
                                {
                                    StdItem = Item;
                                    ItemUnit.GetItemAddValue(UserItem, StdItem);
                                    M2Share.CopyStdItemToOStdItem(StdItem, &OClientItem->s);// 取自定义物品名称
                                    sUserItemName = "";
                                    if (UserItem->btValue[13] == 1)
                                    {
                                        sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                                    }
                                    if (sUserItemName != "")
                                    {
                                        HUtil32.StrToSByteArry(sUserItemName, OClientItem->s.Name, 14, ref OClientItem->s.NameLen);
                                    }
                                    OClientItem->Dura = UserItem->Dura;
                                    OClientItem->DuraMax = UserItem->DuraMax;
                                    OClientItem->MakeIndex = UserItem->MakeIndex;
                                    if (StdItem->StdMode == 50)
                                    {
                                        string stemp = HUtil32.SBytePtrToString(OClientItem->s.Name, 0, OClientItem->s.NameLen);//临时存放物品名称
                                        HUtil32.StrToSByteArry(stemp + "#" + (UserItem->Dura), OClientItem->s.Name, 14, ref OClientItem->s.NameLen);
                                    }
                                    sSENDMSG = sSENDMSG + EncryptUnit.EncodeBuffer(OClientItem, Marshal.SizeOf(typeof(TOClientItem))) + "/";
                                }
                            }
                        }
                    }
                    if (sSENDMSG != "")
                    {
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_BAGITEMS, HUtil32.ObjectToInt(this), 0, 0, this.m_ItemList.Count, 0);
                        SendSocket(this.m_DefMsg, sSENDMSG);
                    }
                }
                else
                {
                    sSENDMSG = "";
                    if (this.m_ItemList.Count > 0)
                    {
                        for (int I = 0; I < this.m_ItemList.Count; I++)
                        {
                            UserItem = (TUserItem*)this.m_ItemList[I];
                            if (UserItem != null)
                            {
                                Item = UserEngine.GetStdItem(UserItem->wIndex);
                                if (Item != null)
                                {
                                    StdItem = Item;
                                    ItemUnit.GetItemAddValue(UserItem, StdItem);
                                    ClientItem = (TClientItem*)Marshal.AllocHGlobal(sizeof(TClientItem));
                                    ClientItem->s = *StdItem;
                                    sUserItemName = "";  // 取自定义物品名称
                                    if (UserItem->btValue[13] == 1)
                                    {
                                        sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                                    }
                                    if (UserItem->btValue[12] == 1) // 物品发光
                                    {
                                        ClientItem->s.Reserved1 = 1;
                                    }
                                    else
                                    {
                                        ClientItem->s.Reserved1 = 0;
                                    }
                                    if (sUserItemName != "")
                                    {
                                        HUtil32.StrToSByteArry(sUserItemName, ClientItem->s.Name, 14, ref ClientItem->s.NameLen);
                                        //ClientItem->s->Name = sUserItemName;
                                    }
                                    if ((StdItem->StdMode == 60) && (StdItem->Shape != 0))// 酒类,除烧酒外
                                    {
                                        if (UserItem->btValue[0] != 0)
                                        {
                                            ClientItem->s.AC = UserItem->btValue[0];// 酒的品质
                                        }
                                        if (UserItem->btValue[1] != 0)
                                        {
                                            ClientItem->s.MAC = UserItem->btValue[1];// 酒的酒精度
                                        }
                                    }
                                    if (StdItem->StdMode == 8) // 酿酒材料
                                    {
                                        if (UserItem->btValue[0] != 0)
                                        {
                                            ClientItem->s.AC = UserItem->btValue[0]; // 材料的品质
                                        }
                                    }
                                    ClientItem->Dura = UserItem->Dura;
                                    ClientItem->DuraMax = UserItem->DuraMax;
                                    ClientItem->MakeIndex = UserItem->MakeIndex;
                                    sSENDMSG = sSENDMSG + EncryptUnit.EncodeBuffer(ClientItem, sizeof(TClientItem)) + "/";
                                }
                            }
                        }
                    }
                    if (sSENDMSG != "")
                    {
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_BAGITEMS, HUtil32.ObjectToInt(this), 0, 0, this.m_ItemList.Count, 0);
                        SendSocket(this.m_DefMsg, sSENDMSG);
                    }
                    IsItem_51(1);// 发送聚灵珠的经验
                }
            }
            finally
            {
                m_boCanQueryBag = false;
            }
        }

        // 取玩家的等级排名
        public int GetUserLevelOrder()
        {
            int result;
            int nIndex;
            List<string> PlayLevelOrder;
            string sCharName;
            string CharName;
            result = 0;
            //EnterCriticalSection(M2Share.HumanSortCriticalSection);
            //try
            //{
            //    PlayLevelOrder = M2Share.GetPlayObjectOrderList(0);
            //    if (PlayLevelOrder != null)
            //    {
            //        if (PlayLevelOrder.Count > 0)
            //        {
            //            for (nIndex = 0; nIndex < PlayLevelOrder.Count; nIndex++)
            //            {
            //                CharName = ((string[])(PlayLevelOrder.Values[nIndex]));
            //                sCharName = CharName;
            //                if ((this.m_sCharName).ToLower().CompareTo((sCharName).ToLower()) == 0)
            //                {
            //                    result = nIndex + 1;
            //                    break;
            //                }
            //            }
            //        }
            //    }
            //}
            //finally
            //{
            //    LeaveCriticalSection(M2Share.HumanSortCriticalSection);
            //}
            return result;
        }

        // 获取人物等级排行  NPC
        public string UserLevelOrder_Add_space(string Str, int Size)
        {
            string result;
            result = Str;
            if (Str.Length >= Size)
            {
                return result;
            }
            while (result.Length < Size)
            {
                result = result + " ";
            }
            return result;
        }

        private void UserLevelOrder(int BaseObject)
        {
            int nIndex;
            int nPage;
            string sIndex;
            string sCharName = string.Empty;
            string sLevel;
            List<string> PlayObjectList = null;
            bool boFound;
            int n01;
            int n02;
            string s01;
            TMerchant Merchant;
            string CharName;
            const string sFirstStr1 = "序位                  角色名                      等级\\";
            const string sFirstStr2 = "序位                  角色名                出师徒弟数\\";
            const string sNotFoundStr = "您没有上榜或不在该榜！！！\\";
            HUtil32.EnterCriticalSection(M2Share.HumanSortCriticalSection);
            try
            {
                m_PlayOrderList.Clear();
                if (m_nSelPlayOrderType == 4)
                {
                    m_PlayOrderList.Add(sFirstStr2);
                }
                else
                {
                    m_PlayOrderList.Add(sFirstStr1);
                }
                // PlayObjectList = M2Share.GetPlayObjectOrderList(m_nSelPlayOrderType);
                nPage = m_nPlayOrderPage;
                if (PlayObjectList != null)
                {
                    if (m_boGetMyLevelOrder)// 我的排行
                    {
                        m_boGetMyLevelOrder = false;
                        boFound = false;
                        if (PlayObjectList.Count > 0)
                        {
                            for (nIndex = 0; nIndex < PlayObjectList.Count; nIndex++)
                            {
                                // CharName = ((string[])(PlayObjectList.Values[nIndex]));
                                //sCharName = CharName;
                                if ((this.m_sCharName).ToLower().CompareTo((sCharName).ToLower()) == 0)
                                {
                                    sIndex = (nIndex + 1).ToString();
                                    sLevel = PlayObjectList[nIndex];
                                    sIndex = UserLevelOrder_Add_space(sIndex, 4 + 18);
                                    sCharName = UserLevelOrder_Add_space(sCharName, 14 + 14);
                                    m_PlayOrderList.Add(sIndex + sCharName + sLevel + "\\");
                                    boFound = true;
                                    break;
                                }
                            }
                        }
                        if (!boFound)
                        {
                            m_PlayOrderList.Clear();
                            m_PlayOrderList.Add(sNotFoundStr);
                        }
                    }
                    else
                    {
                        n01 = 0;
                        if (nPage > 0)
                        {
                            for (nIndex = nPage * 7; nIndex < PlayObjectList.Count; nIndex++)
                            {
                                if (n01 >= 7)
                                {
                                    break;
                                }
                                sIndex = (nIndex + 1).ToString();
                                //CharName = ((string[])(PlayObjectList.Values[nIndex]));
                                //sCharName = CharName;
                                sLevel = PlayObjectList[nIndex];
                                sIndex = UserLevelOrder_Add_space(sIndex, 4 + 18);
                                sCharName = UserLevelOrder_Add_space(sCharName, 14 + 14);
                                m_PlayOrderList.Add(sIndex + sCharName + sLevel + "\\");
                                n01++;
                            }
                        }
                        else
                        {
                            if (PlayObjectList.Count > 0)
                            {
                                for (nIndex = 0; nIndex < PlayObjectList.Count; nIndex++)
                                {
                                    if (n01 >= 7)
                                    {
                                        break;
                                    }
                                    sIndex = (nIndex + 1).ToString();
                                    //CharName = ((string[])(PlayObjectList.Values[nIndex]));
                                    //sCharName = CharName;
                                    sLevel = PlayObjectList[nIndex];
                                    sIndex = UserLevelOrder_Add_space(sIndex, 4 + 18);
                                    sCharName = UserLevelOrder_Add_space(sCharName, 14 + 14);
                                    m_PlayOrderList.Add(sIndex + sCharName + sLevel + "\\");
                                    n01++;
                                }
                            }
                        }
                    }
                }
                if (m_PlayOrderList.Count > 0)
                {
                    n02 = 8 - m_PlayOrderList.Count;
                    if (n02 > 0)
                    {
                        for (nIndex = 1; nIndex <= n02; nIndex++)
                        {
                            s01 = m_PlayOrderList[m_PlayOrderList.Count - 1];
                            m_PlayOrderList[m_PlayOrderList.Count - 1] = s01 + " \\";
                        }
                    }
                }
                Merchant = UserEngine.FindMerchant(BaseObject);
                if (Merchant != null)
                {
                    Merchant.GotoLable(this, "@LevelOrder", false);
                }
            }
            finally
            {
                HUtil32.LeaveCriticalSection(M2Share.HumanSortCriticalSection);
            }
        }

        /// <summary>
        /// 客户端查看别人的装备
        /// </summary>
        /// <param name="BaseObject"></param>
        /// <param name="nX"></param>
        /// <param name="nY"></param>
        private unsafe void ClientQueryUserState(TBaseObject BaseObject, int nX, int nY)
        {
            TUserStateInfo UserState = new TUserStateInfo();
            TOUserStateInfo OUserState = new TOUserStateInfo();
            TStdItem StdItem24;
            TClientItem* ClientItem = null;
            TOClientItem* OClientItem = null;
            string sUserItemName;
            TStdItem* StdItem = null;
            TUserItem* UserItem;
            byte boCopyHum;// 是否是分身
            byte nCode;
            nCode = 0;
            try
            {
                if (BaseObject != null)
                {
                    if (!BaseObject.m_boGhost)
                    {
                        boCopyHum = 0;
                        nCode = 1;
                        if ((m_nSoftVersionDateEx == 0) && (m_dwClientTick == 0))
                        {
                            if (!this.CretInNearXY(BaseObject, nX, nY))
                            {
                                return;
                            }
                            //FillChar(OUserState, sizeof(TOUserStateInfo), '\0');
                            OUserState.feature = BaseObject.GetFeature(this);
                            HUtil32.StrToSByteArry(BaseObject.m_sCharName, OUserState.UserName, 15, ref OUserState.UserNameLen);
                            OUserState.NAMECOLOR = this.GetCharColor(BaseObject);
                            nCode = 2;
                            if (BaseObject.m_btRaceServer == Grobal2.RC_PLAYMOSTER)
                            {
                                if (BaseObject.m_Master != null)
                                {
                                    if (BaseObject.m_Master.m_btRaceServer == Grobal2.RC_PLAYOBJECT)    // 人物的分身
                                    {
                                        HUtil32.StrToSByteArry(BaseObject.m_Master.m_sCharName, UserState.GuildName, 14, ref UserState.GuildNameLen);// 人形显示主人名字
                                        boCopyHum = 1;
                                    }
                                    else if (BaseObject.m_Master.m_btRaceServer == Grobal2.RC_HEROOBJECT) // 英雄的分身
                                    {
                                        HUtil32.StrToSByteArry(BaseObject.m_Master.m_Master.m_sCharName, UserState.GuildName, 14, ref UserState.GuildNameLen);// 显示英雄主人名字
                                        boCopyHum = 2;
                                    }
                                }
                                else
                                {
                                    HUtil32.StrToSByteArry(M2Share.FilterShowName(HUtil32.SBytePtrToString(UserState.UserName, 0, UserState.UserNameLen)),
                                        UserState.UserName, 14, ref UserState.UserNameLen);// 人形怪过滤有数字的名称
                                }
                            }
                            nCode = 3;
                            if (BaseObject.m_btRaceServer == Grobal2.RC_HEROOBJECT) // 如果是英雄 那么就把行会名为主人名
                            {
                                HUtil32.StrToSByteArry(BaseObject.m_Master.m_sCharName, OUserState.GuildName, 14, ref OUserState.GuilidNameLen);
                                boCopyHum = 3;
                            }
                            else
                            {
                                if (BaseObject.m_MyGuild != null)
                                {
                                    HUtil32.StrToSByteArry(BaseObject.m_MyGuild.sGuildName, OUserState.GuildName, 14,
                                        ref OUserState.GuilidNameLen);
                                }
                                HUtil32.StrToSByteArry(BaseObject.m_sGuildRankName, OUserState.GuildRankName, 14, ref OUserState.GuildRankNameLen);
                            }
                            nCode = 4;
                            if (GameConfig.boUnKnowHum && BaseObject.IsUsesZhuLi())
                            {
                                HUtil32.StrToSByteArry("神秘人", UserState.UserName, 14, ref UserState.UserNameLen);// 带上斗笠即显示神秘人
                                HUtil32.StrToSByteArry("", UserState.GuildRankName, 16, ref UserState.GuildRankNameLen);
                                HUtil32.StrToSByteArry("", UserState.GuildName, 14, ref UserState.GuildNameLen);
                                boCopyHum = 0;
                            }
                            nCode = 5;
                            for (int I = m_UseItems.GetLowerBound(0); I <= m_UseItems.GetUpperBound(0); I++)
                            {
                                UserItem = BaseObject.m_UseItems[I];
                                if (UserItem->wIndex > 0)
                                {
                                    StdItem = UserEngine.GetStdItem(BaseObject.m_UseItems[I]->wIndex);
                                    if (StdItem == null)
                                    {
                                        continue;
                                    }
                                    StdItem24 = *StdItem;
                                    ItemUnit.GetItemAddValue(BaseObject.m_UseItems[I], &StdItem24);
                                    // Move(StdItem24,ClientItem->S,SizeOf(TStdItem));
                                    ClientItem = (TClientItem*)Marshal.AllocHGlobal(sizeof(TClientItem));//Dr.Kevin 修正此处没有申请内导致异常
                                    ClientItem->s = StdItem24;
                                    M2Share.CopyStdItemToOStdItem(&StdItem24, &OClientItem->s);// 取自定义物品名称
                                    sUserItemName = "";
                                    if (UserItem->btValue[13] == 1)
                                    {
                                        sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                                    }
                                    if (sUserItemName != "")
                                    {
                                        HUtil32.StrToSByteArry(sUserItemName, OClientItem->s.Name, 14, ref OClientItem->s.NameLen);
                                    }
                                    OClientItem->MakeIndex = BaseObject.m_UseItems[I]->MakeIndex;
                                    OClientItem->Dura = BaseObject.m_UseItems[I]->Dura;
                                    OClientItem->DuraMax = BaseObject.m_UseItems[I]->DuraMax;
                                    TOClientItem* pbtpl = (TOClientItem*)OUserState.UseItemsBuff;
                                    pbtpl[I] = *OClientItem;
                                }
                            }
                            nCode = 6;
                            if (((BaseObject.m_btRaceServer == Grobal2.RC_HEROOBJECT) && (boCopyHum != 0)) ||
                                ((BaseObject.m_btRaceServer == Grobal2.RC_PLAYMOSTER) && (boCopyHum == 2)))
                            {
                                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SENDUSERSTATE, 1, 0, 0, 0, 0);
                            }
                            else if ((boCopyHum == 1) && (BaseObject.m_btRaceServer == Grobal2.RC_PLAYMOSTER))  // 人形客户显示名字+的分身
                            {
                                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SENDUSERSTATE, 2, 0, 0, 0, 0);
                            }
                            else
                            {
                                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SENDUSERSTATE, 0, 0, 0, 0, 0);
                            }
                            byte[] data = new byte[Marshal.SizeOf(typeof(TOUserStateInfo))];
                            fixed (byte* pb = data)
                            {
                                *(TOUserStateInfo*)pb = OUserState;
                            }
                            SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, Marshal.SizeOf(typeof(TOUserStateInfo))));
                        }
                        else
                        {
                            nCode = 7;
                            if (!this.CretInNearXY(BaseObject, nX, nY))
                            {
                                return;
                            }
                            //FillChar(UserState, sizeof(TUserStateInfo), '\0');
                            UserState.feature = BaseObject.GetFeature(this);
                            HUtil32.StrToSByteArry(BaseObject.m_sCharName, UserState.UserName, 14, ref UserState.UserNameLen);
                            UserState.NameColor = this.GetCharColor(BaseObject);
                            nCode = 8;
                            if (BaseObject.m_btRaceServer == Grobal2.RC_PLAYMOSTER)
                            {
                                if (BaseObject.m_Master != null)
                                {
                                    if (BaseObject.m_Master.m_btRaceServer == Grobal2.RC_PLAYOBJECT)  // 人物的分身
                                    {
                                        HUtil32.StrToSByteArry(BaseObject.m_sCharName, UserState.GuildName, 14, ref UserState.GuildNameLen);// 人形显示主人名字
                                        boCopyHum = 1;
                                    }
                                    else if (BaseObject.m_Master.m_btRaceServer == Grobal2.RC_HEROOBJECT) // 英雄的分身
                                    {
                                        HUtil32.StrToSByteArry(BaseObject.m_Master.m_Master.m_sCharName, UserState.GuildName, 14, ref UserState.GuildNameLen);// 显示英雄主人名字
                                        boCopyHum = 2;
                                    }
                                }
                                else
                                {
                                    HUtil32.StrToSByteArry(M2Share.FilterShowName(HUtil32.SBytePtrToString(UserState.UserName, 0, UserState.UserNameLen)),
                                        UserState.UserName, 14, ref UserState.UserNameLen);// 人形怪过滤有数字的名称
                                }
                            }
                            nCode = 9;
                            if (BaseObject.m_btRaceServer == Grobal2.RC_HEROOBJECT)// 如果是英雄 那么就把行会名为主人名
                            {
                                if (GameConfig.boUnKnowHum && BaseObject.m_Master.IsUsesZhuLi())  // 主人为神秘人时
                                {
                                    HUtil32.StrToSByteArry("神秘人", UserState.GuildName, 14, ref UserState.GuildNameLen); //"神秘人";
                                }
                                else
                                {
                                    HUtil32.StrToSByteArry(BaseObject.m_Master.m_sCharName, UserState.GuildName, 14, ref UserState.GuildNameLen);
                                }
                                boCopyHum = 3;
                            }
                            else
                            {
                                if (BaseObject.m_MyGuild != null)
                                {
                                    HUtil32.StrToSByteArry(BaseObject.m_MyGuild.sGuildName, UserState.GuildName, 14, ref UserState.GuildNameLen);
                                }
                                HUtil32.StrToSByteArry(BaseObject.m_sGuildRankName, UserState.GuildRankName, 14,
                                    ref UserState.GuildRankNameLen);
                            }
                            nCode = 10;
                            if (GameConfig.boUnKnowHum && BaseObject.IsUsesZhuLi())
                            {
                                HUtil32.StrToSByteArry("神秘人", UserState.UserName, 14, ref UserState.UserNameLen);
                                HUtil32.StrToSByteArry("", UserState.GuildRankName, 16, ref UserState.GuildRankNameLen);
                                HUtil32.StrToSByteArry("", UserState.GuildName, 14, ref UserState.GuildNameLen);
                                boCopyHum = 0;
                            }
                            nCode = 11;
                            for (int I = m_UseItems.GetLowerBound(0); I <= m_UseItems.GetUpperBound(0); I++)
                            {
                                UserItem = BaseObject.m_UseItems[I];
                                if (UserItem->wIndex > 0)
                                {
                                    StdItem = UserEngine.GetStdItem(BaseObject.m_UseItems[I]->wIndex);
                                    nCode = 12;
                                    if (StdItem == null)
                                    {
                                        continue;
                                    }
                                    StdItem24 = *StdItem;
                                    ItemUnit.GetItemAddValue(BaseObject.m_UseItems[I], &StdItem24);
                                    ClientItem = (TClientItem*)Marshal.AllocHGlobal(sizeof(TClientItem));//By Dr.Kevin修正此处没有申请内存地址，导致异常
                                    ClientItem->s = StdItem24;
                                    nCode = 13;
                                    sUserItemName = "";// 取自定义物品名称
                                    if (UserItem->btValue[13] == 1)
                                    {
                                        sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                                    }
                                    if (UserItem->btValue[12] == 1)// 物品发光
                                    {
                                        ClientItem->s.Reserved1 = 1;
                                    }
                                    else
                                    {
                                        ClientItem->s.Reserved1 = 0;
                                    }
                                    if (sUserItemName != "")
                                    {
                                        HUtil32.StrToSByteArry(sUserItemName, ClientItem->s.Name, 14, ref ClientItem->s.NameLen);
                                    }
                                    nCode = 14;
                                    ClientItem->MakeIndex = BaseObject.m_UseItems[I]->MakeIndex;
                                    ClientItem->Dura = BaseObject.m_UseItems[I]->Dura;
                                    ClientItem->DuraMax = BaseObject.m_UseItems[I]->DuraMax;
                                    TClientItem* pbtpl = (TClientItem*)UserState.UseItemsBuff;
                                    pbtpl[I] = *ClientItem;
                                }
                            }
                            nCode = 15;
                            if (((BaseObject.m_btRaceServer == Grobal2.RC_HEROOBJECT) && (boCopyHum != 0)) || ((BaseObject.m_btRaceServer == Grobal2.RC_PLAYMOSTER) && (boCopyHum == 2)))
                            {
                                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SENDUSERSTATE, 1, 0, 0, 0, 0); // 英雄,英雄的分身
                            }
                            else if ((boCopyHum == 1) && (BaseObject.m_btRaceServer == Grobal2.RC_PLAYMOSTER))
                            {
                                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SENDUSERSTATE, 2, 0, 0, 0, 0); //人形客户显示名字+的分身
                            }
                            else
                            {
                                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SENDUSERSTATE, 0, 0, 0, 0, 0);
                            }
                            byte[] data = new byte[sizeof(TUserStateInfo)];
                            fixed (byte* pb = data)
                            {
                                *(TUserStateInfo*)pb = UserState;
                            }
                            SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TUserStateInfo)));
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.ClientQueryUserState Code:" + nCode);
            }
        }

        /// <summary>
        /// 客户端打开交易NPC
        /// 选择商品分类（大类）
        /// </summary>
        /// <param name="nParam1"></param>
        /// <param name="sMsg"></param>
        private void ClientMerchantDlgSelect(int nParam1, string sMsg)
        {
            TNormNpc NPC;
            if (this.m_boDeath || this.m_boGhost)
            {
                return;
            }
            NPC = UserEngine.FindMerchant(nParam1);
            if (NPC == null)
            {
                NPC = UserEngine.FindNPC(nParam1);
            }
            if (NPC == null)
            {
                return;
            }
            if (((NPC.m_PEnvir == this.m_PEnvir) && (Math.Abs(NPC.m_nCurrX - this.m_nCurrX) < 15) && (Math.Abs(NPC.m_nCurrY - this.m_nCurrY) < 15)) || (NPC.m_boIsHide))
            {
                NPC.UserSelect(this, sMsg.Trim());
            }
        }

        /// <summary>
        /// 客户端卖物品查询价格
        /// </summary>
        /// <param name="nParam1"></param>
        /// <param name="nMakeIndex"></param>
        /// <param name="sMsg"></param>
        private unsafe void ClientMerchantQuerySellPrice(int nParam1, int nMakeIndex, string sMsg)
        {
            TUserItem* UserItem;
            TUserItem* UserItem18 = null;
            TMerchant Merchant;
            string sUserItemName;
            if (this.m_ItemList.Count > 0)
            {
                for (int I = 0; I < this.m_ItemList.Count; I++)
                {
                    UserItem = (TUserItem*)this.m_ItemList[I];
                    if (UserItem == null)
                    {
                        continue;
                    }
                    if (UserItem->MakeIndex == nMakeIndex)
                    {
                        sUserItemName = "";// 取自定义物品名称
                        if (UserItem->btValue[13] == 1)
                        {
                            sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                        }
                        if (sUserItemName == "")
                        {
                            sUserItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                        }
                        if (string.Compare(sUserItemName, sMsg, true) == 0)
                        {
                            UserItem18 = UserItem;
                            break;
                        }
                    }
                }
            }
            if (UserItem18 == null)
            {
                return;
            }
            Merchant = UserEngine.FindMerchant(nParam1);
            if (Merchant == null)
            {
                return;
            }
            if (((Merchant.m_PEnvir == this.m_PEnvir) && (Merchant.m_boSell) && (Math.Abs(Merchant.m_nCurrX - this.m_nCurrX) < 15) &&
                (Math.Abs(Merchant.m_nCurrY - this.m_nCurrY) < 15)))
            {
                Merchant.ClientQuerySellPrice(this, UserItem18);
            }
        }

        /// <summary>
        /// 客户端卖物品(出售物品)
        /// </summary>
        /// <param name="nParam1"></param>
        /// <param name="nMakeIndex"></param>
        /// <param name="sMsg"></param>
        private unsafe void ClientUserSellItem(int nParam1, int nMakeIndex, string sMsg)
        {
            TUserItem* UserItem;
            TMerchant Merchant;
            string sUserItemName;
            TStdItem* StdItem;
            m_boCanQueryBag = true;// 出售物品时,不能刷新包裹
            try
            {
                for (int I = this.m_ItemList.Count - 1; I >= 0; I--)
                {
                    if (this.m_ItemList.Count <= 0)
                    {
                        break;
                    }
                    UserItem = (TUserItem*)this.m_ItemList[I];
                    if ((UserItem != null) && (UserItem->MakeIndex == nMakeIndex))
                    {
                        sUserItemName = "";// 取自定义物品名称
                        if (UserItem->btValue[13] == 1)
                        {
                            sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                        }
                        if (sUserItemName == "")
                        {
                            sUserItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                        }
                        if (string.Compare(sUserItemName, sMsg, true) == 0)
                        {
                            if (this.CheckItemValue(UserItem, 4) || this.PlugOfCheckCanItem(1, sUserItemName, true, 0, 0))// 禁止物品规则(禁止交易)
                            {
                                this.SendMsg(this, Grobal2.RM_USERSELLITEM_FAIL, 0, 0, 0, 0, "");// 出售失败消息
                                break;
                            }
                            Merchant = UserEngine.FindMerchant(nParam1);
                            if ((Merchant != null))
                            {
                                if ((Merchant.m_boSell) && ((Merchant.m_PEnvir == this.m_PEnvir) && (Math.Abs(Merchant.m_nCurrX - this.m_nCurrX) < 15) && (Math.Abs(Merchant.m_nCurrY - this.m_nCurrY) < 15)))
                                {
                                    if (Merchant.ClientSellItem(this, UserItem))
                                    {
                                        StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                                        if ((StdItem != null) && (StdItem->StdMode == 51) && (StdItem->Shape == 0) && (UserItem->Dura > 0) && (UserItem->btValue[20] == 1)) // 是聚灵珠
                                        {
                                            m_DealCreat.n_UsesItemTick = 0;// 时间初始
                                            UserItem->btValue[12] = 2;// 不能聚集的标识
                                        }
                                        if (UserItem->btValue[13] == 1)
                                        {
                                            ItemUnit.DelCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                                            UserItem->btValue[13] = 0;
                                        }
                                        Marshal.FreeHGlobal((IntPtr)UserItem);//物品加到NPC物品列表中了
                                        this.m_ItemList.RemoveAt(I);
                                        this.WeightChanged();
                                    }
                                }
                            }
                            break;
                        }
                    }
                }
            }
            finally
            {
                m_boCanQueryBag = false;// 出售物品时,不能刷新包裹
            }
        }

        /// <summary>
        /// 客户端购买物品
        /// </summary>
        /// <param name="nIdent"></param>
        /// <param name="nParam1"></param>
        /// <param name="nInt"></param>
        /// <param name="nZz"></param>
        /// <param name="sMsg"></param>
        private void ClientUserBuyItem(int nIdent, int nParam1, int nInt, int nZz, string sMsg)
        {
            TMerchant Merchant;
            try
            {
                if (m_boDealing)
                {
                    return;
                }
                Merchant = UserEngine.FindMerchant(nParam1);
                if ((Merchant == null) || (!Merchant.m_boBuy) || (Merchant.m_PEnvir != this.m_PEnvir) ||
                    (Math.Abs(Merchant.m_nCurrX - this.m_nCurrX) > 15) || (Math.Abs(Merchant.m_nCurrY - this.m_nCurrY) > 15))
                {
                    return;
                }
                if (nIdent == Grobal2.CM_USERBUYITEM)// 卖入物品 1014
                {
                    Merchant.ClientBuyItem(this, sMsg, nInt);
                }
                if (nIdent == Grobal2.CM_USERGETDETAILITEM)// 1015
                {
                    Merchant.ClientGetDetailGoodsList(this, sMsg, nZz);
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.ClientUserBuyItem wIdent = " + nIdent);
            }
        }

        /// <summary>
        /// 玩家仍金币
        /// </summary>
        /// <param name="nGold"></param>
        /// <returns></returns>
        private bool ClientDropGold(int nGold)
        {
            bool result = false;
            if (GameConfig.boInSafeDisableDrop && this.InSafeZone())
            {
                this.SendMsg(M2Share.g_ManageNPC, Grobal2.RM_MENU_OK, 0, this.ToInt(), 0, 0, GameMsgDef.g_sCanotDropInSafeZoneMsg);
                return result;
            }
            if (GameConfig.boControlDropItem && (nGold < GameConfig.nCanDropGold))
            {
                this.SendMsg(M2Share.g_ManageNPC, Grobal2.RM_MENU_OK, 0, this.ToInt(), 0, 0, GameMsgDef.g_sCanotDropGoldMsg);
                return result;
            }
            if (!m_boCanDrop)
            {
                this.SendMsg(M2Share.g_ManageNPC, Grobal2.RM_MENU_OK, 0, this.ToInt(), 0, 0, GameMsgDef.g_sCanotDropItemMsg);
                return result;
            }
            if (nGold >= this.m_nGold)
            {
                return result;
            }
            this.m_nGold -= nGold;
            if (!this.DropGoldDown(nGold, false, null, this))
            {
                this.m_nGold += nGold;
            }
            this.GoldChanged();
            result = true;
            return result;
        }

        /// <summary>
        /// 玩家扔物品
        /// </summary>
        /// <param name="sItemName"></param>
        /// <param name="nItemIdx"></param>
        /// <returns></returns>
        private unsafe bool ClientDropItem(string sItemName, int nItemIdx)
        {
            bool result = false;
            int wIndex;
            int MakeIndex;
            TUserItem* UserItem;
            TStdItem* StdItem;
            string sUserItemName;
            byte nCode = 0;
            m_boCanQueryBag = true;// 扔物品时,不能刷新包裹
            try
            {
                try
                {
                    if (!m_boClientFlag)
                    {
                        if (m_nStep == 8)
                        {
                            m_nStep++;
                        }
                        else
                        {
                            m_nStep = 0;
                        }
                    }
                    nCode = 1;
                    if (GameConfig.boInSafeDisableDrop && this.InSafeZone())
                    {
                        this.SendMsg(M2Share.g_ManageNPC, Grobal2.RM_MENU_OK, 0, this.ToInt(), 0, 0, GameMsgDef.g_sCanotDropInSafeZoneMsg);
                        return result;
                    }
                    nCode = 2;
                    if (!m_boCanDrop)
                    {
                        this.SendMsg(M2Share.g_ManageNPC, Grobal2.RM_MENU_OK, 0, this.ToInt(), 0, 0, GameMsgDef.g_sCanotDropItemMsg);
                        return result;
                    }
                    if (sItemName.IndexOf(" ") > 0)
                    {
                        // 折分物品名称(信件物品的名称后面加了使用次数)
                        HUtil32.GetValidStr3(sItemName, ref sItemName, new string[] { " " });
                    }
                    nCode = 3;
                    if ((HUtil32.GetTickCount() - m_DealLastTick) > 3000)
                    {
                        for (int I = this.m_ItemList.Count - 1; I >= 0; I--)
                        {
                            if (this.m_ItemList.Count <= 0)
                            {
                                break;
                            }
                            UserItem = (TUserItem*)this.m_ItemList[I];
                            if ((UserItem != null) && (UserItem->MakeIndex == nItemIdx))
                            {
                                StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                                if (StdItem == null)
                                {
                                    continue;
                                }
                                sUserItemName = "";// 取自定义物品名称
                                if (UserItem->btValue[13] == 1)
                                {
                                    sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                                }
                                if (sUserItemName == "")
                                {
                                    sUserItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                                }
                                if (string.Compare(sUserItemName, sItemName, true) == 0)
                                {
                                    nCode = 4;
                                    if (this.CheckItemValue(UserItem, 0)) // 检查物品是否禁止扔
                                    {
                                        break;
                                    }
                                    nCode = 5;
                                    if (this.PlugOfCheckCanItem(0, HUtil32.SBytePtrToString(StdItem->Name, StdItem->NameLen), false, 0, 0)) // 禁止物品规则(管理插件功能)
                                    {
                                        break;
                                    }
                                    nCode = 6;
                                    if (GameConfig.boStartMapEvent)
                                    {
                                        if (this.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                                        {
                                            StartMapEventOfDropItem(sUserItemName); // 地图触发,扔物品事件
                                        }
                                    }
                                    if ((StdItem->StdMode == 51) && (StdItem->Shape == 0) && (UserItem->Dura > 0) && (UserItem->btValue[20] == 1)) // 是聚灵珠
                                    {
                                        n_UsesItemTick = 0;// 时间初始
                                        UserItem->btValue[12] = 2;// 不能聚集的标识
                                    }
                                    nCode = 7;
                                    wIndex = UserItem->wIndex;
                                    MakeIndex = UserItem->MakeIndex;
                                    nCode = 8;
                                    if (GameConfig.boControlDropItem && (StdItem->Price < GameConfig.nCanDropPrice))
                                    {
                                        nCode = 9;
                                        Marshal.FreeHGlobal((IntPtr)UserItem);
                                        this.m_ItemList.RemoveAt(I);
                                        nCode = 10;
                                        ClearCopyItem(0, wIndex, MakeIndex);// 清理复制品
                                        result = true;
                                        break;
                                    }
                                    nCode = 11;
                                    if (this.DropItemDown(UserItem, 3, false, false, null, this))
                                    {
                                        nCode = 12;
                                        if (UserItem != null)
                                        {
                                            Marshal.FreeHGlobal((IntPtr)UserItem); //By John 修正此原处导致程序崩溃
                                        }
                                        nCode = 15;
                                        this.m_ItemList.RemoveAt(I);
                                        nCode = 13;
                                        ClearCopyItem(0, wIndex, MakeIndex);//清理复制品
                                        result = true;
                                        break;
                                    }
                                }
                            }
                        }
                        nCode = 14;
                        if (result)
                        {
                            this.WeightChanged();
                        }
                    }
                }
                catch
                {
                    M2Share.MainOutMessage("{异常} TPlayObject.ClientDropItem Code:" + nCode);
                }
            }
            finally
            {
                m_boCanQueryBag = false;// 扔物品时,不能刷新包裹
            }
            return result;
        }

        public void GoldChange(string sChrName, long nGold)
        {
            string s10;
            string s14;
            if (nGold > 0)
            {
                s10 = "14";
                s14 = "增加完成";
            }
            else
            {
                s10 = "13";
                s14 = "以删减";
            }
            this.SysMsg(sChrName + " 的金币 " + (nGold).ToString() + " 金币" + s14, TMsgColor.c_Green, TMsgType.t_Hint);
            if (M2Share.g_boGameLogGold)
            {
                M2Share.AddGameDataLog(s10 + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString() + "\09" + (this.m_nCurrY).ToString()
                    + "\09" + this.m_sCharName + "\09" + M2Share.sSTRING_GOLDNAME + "\09" + (nGold).ToString() + "\09" + "1" + "\09" + sChrName);
            }
        }

        /// <summary>
        /// 清楚玩家状态
        /// </summary>
        public void ClearStatusTime()
        {
            for (int i = 0; i < this.m_wStatusTimeArr.Length; i++)
            {
                this.m_wStatusTimeArr[i] = 0;
            }
        }

        /// <summary>
        /// 发送地图音乐背景数据
        /// </summary>
        private void SendMapDescription()
        {
            int nMUSICID = -1;
            string sMUSINAME = string.Empty;
            if (this.m_PEnvir.m_boMUSIC)
            {
                nMUSICID = this.m_PEnvir.m_nMUSICID;
                sMUSINAME = this.m_PEnvir.m_sMUSICName;
            }
            if (nMUSICID >= 0)
            {
                SendDefMessage(Grobal2.SM_MAPDESCRIPTION, nMUSICID, 0, 0, 0, this.m_PEnvir.sMapDesc);
            }
            else
            {
                SendDefMessage(Grobal2.SM_MAPDESCRIPTION, -1, 0, 0, 0, this.m_PEnvir.sMapDesc + '\r' + sMUSINAME);
            }
            if (this.m_PEnvir.m_boMUSIC)
            {
                nMUSICID = this.m_PEnvir.m_nMUSICID;
            }
            SendDefMessage(Grobal2.SM_MAPDESCRIPTION, nMUSICID, 0, 0, 0, this.m_PEnvir.sMapDesc);
        }

        /// <summary>
        /// 发送游戏公告
        /// </summary>
        private void SendNotice()
        {
            string sNoticeMsg = string.Empty;
            List<string> LoadList = new List<string>();
            M2Share.NoticeManager.GetNoticeMsg("Notice", LoadList);
            if (LoadList.Count > 0)
            {
                for (int I = 0; I < LoadList.Count; I++)
                {
                    sNoticeMsg = sNoticeMsg + LoadList[I] + "\x20\x1B";
                }
            }
            Dispose(LoadList);
            SendDefMessage(Grobal2.SM_SENDNOTICE, 2000, 0, 0, 0, sNoticeMsg.ToString().Replace("/r/n/r/n ", ""));
        }

        /// <summary>
        /// 人物登录游戏
        /// </summary>
        public unsafe virtual void UserLogon()
        {
            TUserItem* UserItem = null;
            TUserItem* UserItem1 = null;
            TStdItem* StdItem;
            string s14;
            string sItem;
            string sIPaddr;
            int n08;
            int n09;
            byte nCode;
            TUserMagic* UserMagic;
            const string sExceptionMsg = "{异常} TPlayObject::UserLogon";
            const string sCheckIPaddrFail = "登录IP地址不匹配！！！";
            sIPaddr = "";
            nCode = 0;
            try
            {
                if (GameConfig.boTestServer)
                {
                    nCode = 1;
                    if (this.m_Abil.Level < GameConfig.nTestLevel)
                    {
                        this.m_Abil.Level = GameConfig.nTestLevel;
                    }
                    if (this.m_nGold < GameConfig.nTestGold)
                    {
                        this.m_nGold = GameConfig.nTestGold;
                    }
                }
                nCode = 2;
                if (GameConfig.boTestServer || (GameConfig.boServiceMode))
                {
                    m_nPayMent = 3;
                }
                this.m_dwMapMoveTick = HUtil32.GetTickCount();
                m_dLogonTime = DateTime.Now;
                m_dwLogonTick = HUtil32.GetTickCount();
                nCode = 3;
                this.Initialize();//初始化
                nCode = 4;
                this.SendMsg(this, Grobal2.RM_LOGON, 0, 0, 0, 0, "");
                nCode = 5;
                if (this.m_Abil.Level <= 7)
                {
                    if (GetRangeHumanCount() >= 80)
                    {
                        this.MapRandomMove(this.m_PEnvir.sMapName, 0);
                    }
                }
                if (m_boDieInFight3Zone)
                {
                    this.MapRandomMove(this.m_PEnvir.sMapName, 0);
                }
                nCode = 6;
                if (UserEngine.GetHumPermission(this.m_sCharName, ref sIPaddr, ref this.m_btPermission))// 取人物权限值
                {
                    if (!M2Share.CompareIPaddr(m_sIPaddr, sIPaddr))
                    {
                        this.SysMsg(sCheckIPaddrFail, TMsgColor.c_Red, TMsgType.t_Hint);
                        m_boEmergencyClose = true;
                        m_boPlayOffLine = false;
                    }
                }
                nCode = 7;
                GetStartPoint();
                nCode = 8;
                for (int I = 0; I < this.m_MagicList.Count; I++)
                {
                    if (this.m_MagicList.Count <= 0)
                    {
                        break;
                    }
                    if (((TUserMagic*)this.m_MagicList[I]) != null)
                    {
                        this.sub_4C713C(((TUserMagic*)this.m_MagicList[I]));
                    }
                }
                nCode = 9;
                if (m_boNewHuman)// 给新人增加新人物品
                {
                    UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                    if (UserEngine.CopyToUserItemFromName(GameConfig.sCandle, UserItem))
                    {
                        this.m_ItemList.Add((IntPtr)UserItem);
                    }
                    else
                    {
                        Marshal.FreeHGlobal((IntPtr)UserItem);
                    }
                    UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                    if (UserEngine.CopyToUserItemFromName(GameConfig.sBasicDrug, UserItem))
                    {
                        this.m_ItemList.Add((IntPtr)UserItem);
                    }
                    else
                    {
                        Marshal.FreeHGlobal((IntPtr)UserItem);
                    }
                    UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                    if (UserEngine.CopyToUserItemFromName(GameConfig.sWoodenSword, UserItem))
                    {
                        this.m_ItemList.Add((IntPtr)UserItem);
                    }
                    else
                    {
                        Marshal.FreeHGlobal((IntPtr)UserItem);
                    }
                    if (this.m_btGender == 0) //性别 0 男 1女
                    {
                        sItem = GameConfig.sClothsMan;
                    }
                    else
                    {
                        sItem = GameConfig.sClothsWoman;
                    }
                    UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                    if (UserEngine.CopyToUserItemFromName(sItem, UserItem))
                    {
                        this.m_ItemList.Add((IntPtr)UserItem);
                    }
                    else
                    {
                        Marshal.FreeHGlobal((IntPtr)UserItem);
                    }
                }
                nCode = 10;
                // 检查背包中的物品是否合法
                for (int I = this.m_ItemList.Count - 1; I >= 0; I--)
                {
                    if (this.m_ItemList.Count <= 0)
                    {
                        break;
                    }
                    UserItem = (TUserItem*)this.m_ItemList[I];
                    if (UserItem != null)
                    {
                        if ((UserEngine.GetStdItemName(UserItem->wIndex) == "")
                            || (UserItem->MakeIndex < 0)//增加，判断制造ID是否为负数
                            || this.CheckIsOKItem(UserItem, 0))
                        {
                            // 检查变态物品
                            M2Share.MainOutMessage("[登录清包裹非法物品](" + this.m_sCharName + ")" + UserEngine.GetStdItemName(UserItem->wIndex) + "("
                                + (UserItem->MakeIndex).ToString() + ")[" + (UserItem->btValue[0]).ToString() + "/" + (UserItem->btValue[1]).ToString() + "/"
                                + (UserItem->btValue[2]).ToString() + "/" + (UserItem->btValue[3]).ToString() + "/" + (UserItem->btValue[4]).ToString() + "/"
                                + (UserItem->btValue[5]).ToString() + "/" + (UserItem->btValue[6]).ToString() + "/" + (UserItem->btValue[7]).ToString() + "/"
                                + (UserItem->btValue[8]).ToString() + "/" + (UserItem->btValue[14]).ToString() + "/#" + (UserItem->btValue[15]).ToString()
                                + "/" + (UserItem->btValue[16]).ToString() + "/" + (UserItem->btValue[17]).ToString() + "/" + (UserItem->btValue[18]).ToString()
                                + "/" + (UserItem->btValue[19]).ToString()); // 记录清除非法物品信息
                            Dispose((IntPtr)this.m_ItemList[I]);
                            this.m_ItemList.RemoveAt(I);
                        }
                    }
                }
                nCode = 11;
                // 检查人物身上的物品是否符合使用规则
                if (GameConfig.boCheckUserItemPlace)
                {
                    for (int I = m_UseItems.GetLowerBound(0); I <= m_UseItems.GetUpperBound(0); I++)
                    {
                        if (this.m_UseItems[I]->wIndex > 0)
                        {
                            StdItem = UserEngine.GetStdItem(this.m_UseItems[I]->wIndex);
                            if (StdItem != null)
                            {
                                if (this.CheckIsOKItem(this.m_UseItems[I], 0))  // 检查变态物品
                                {
                                    this.m_UseItems[I]->wIndex = 0;
                                    continue;
                                }
                                if (!M2Share.CheckUserItems(I, StdItem))
                                {
                                    UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));//by John 修正此次没有申请内存导致程序异常
                                    for (int i = 0; i < 22; i++)
                                    {
                                        UserItem->btValue[i] = 0;
                                    }
                                    *UserItem = *this.m_UseItems[I];
                                    if (!this.AddItemToBag(UserItem))
                                    {
                                        this.m_ItemList.Insert(0, (IntPtr)UserItem);
                                    }
                                    this.m_UseItems[I]->wIndex = 0;
                                }
                            }
                            else
                            {
                                this.m_UseItems[I]->wIndex = 0;
                            }
                        }
                    }
                }
                nCode = 12;
                for (int I = this.m_ItemList.Count - 1; I >= 0; I--) // 检查背包中是否有复制品
                {
                    if (this.m_ItemList.Count <= 0)
                    {
                        break;
                    }
                    UserItem = (TUserItem*)this.m_ItemList[I];
                    if (UserItem != null)
                    {
                        s14 = UserEngine.GetStdItemName(UserItem->wIndex);
                        for (int II = I - 1; II >= 0; II--)
                        {
                            UserItem1 = (TUserItem*)this.m_ItemList[II];
                            if ((UserEngine.GetStdItemName(UserItem1->wIndex) == s14) && (UserItem->MakeIndex == UserItem1->MakeIndex))
                            {
                                M2Share.MainOutMessage("[登录清包裹复制品](" + this.m_sCharName + ")" + s14 + "(" + UserItem1->MakeIndex + ")");//记录清除复制品信息
                                this.m_ItemList.RemoveAt(II);
                                break;
                            }
                        }
                    }
                }
                nCode = 13;
                for (int I = this.m_dwStatusArrTick.GetLowerBound(0); I <= this.m_dwStatusArrTick.GetUpperBound(0); I++)
                {
                    if (this.m_wStatusTimeArr[I] > 0)
                    {
                        this.m_dwStatusArrTick[I] = HUtil32.GetTickCount();
                    }
                }
                nCode = 14;
                this.m_nCharStatus = this.GetCharStatus();
                this.RecalcLevelAbilitys();// 重新计算角色的等级各属性
                RecalcAbilitys(); // 刷新能力
                this.CompareSuitItem(true);// 套装与身上装备对比
                nCode = 15;
                this.m_Abil.MaxExp = this.GetLevelExp(this.m_Abil.Level);
                if (this.btB2 == 0)
                {
                    this.m_nPkPoint = 0;
                    this.btB2++;
                }
                nCode = 16;
                if ((this.m_nGold > GameConfig.nHumanMaxGold * 2) && (GameConfig.nHumanMaxGold > 0))
                {
                    this.m_nGold = GameConfig.nHumanMaxGold * 2;
                }
                if (!bo6AB)
                {
                    if ((m_nSoftVersionDate < GameConfig.nSoftVersionDate))// 对比客户端版本号
                    {
                        nCode = 17;
                        this.SysMsg(GameMsgDef.sClientSoftVersionError, TMsgColor.c_Red, TMsgType.t_Hint);
                        this.SysMsg(GameMsgDef.sDownLoadNewClientSoft, TMsgColor.c_Red, TMsgType.t_Hint);
                        this.SysMsg(GameMsgDef.sForceDisConnect, TMsgColor.c_Red, TMsgType.t_Hint);
                        m_boEmergencyClose = true;
                        m_boPlayOffLine = false;
                        return;
                    }
                    if ((m_nSoftVersionDateEx == 0))
                    {
                        if ((!GameConfig.boCanOldClientLogon)) // 如果不允许普通客户端登录,则退出
                        {
                            nCode = 18;
                            this.SysMsg(GameMsgDef.sClientSoftVersionError, TMsgColor.c_Red, TMsgType.t_Hint);
                            this.SysMsg(GameMsgDef.sDownLoadNewClientSoft, TMsgColor.c_Red, TMsgType.t_Hint);
                            this.SysMsg(GameMsgDef.sForceDisConnect, TMsgColor.c_Red, TMsgType.t_Hint);
                            m_boEmergencyClose = true;
                            m_boPlayOffLine = false;
                            return;
                        }
                        if (GameConfig.boOldClientShowHiLevel)
                        {
                            nCode = 19;
                            this.SysMsg(GameMsgDef.sClientSoftVersionTooOld, TMsgColor.c_Blue, TMsgType.t_Hint);
                            this.SysMsg(GameMsgDef.sDownLoadAndUseNewClient, TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                    }
                    nCode = 20;
                    switch (this.m_btAttatckMode)
                    {
                        case M2Share.HAM_ALL://加入聊天框中提示
                            this.SendMsg(this, Grobal2.RM_CHANGEATTATCKMODE, 0, 0, 0, 0, GameMsgDef.sAttackModeOfAll);// [攻击模式: 全体攻击]
                            this.SysMsg(GameMsgDef.sAttackModeOfAll, TMsgColor.c_Green, TMsgType.t_Hint);
                            break;
                        case M2Share.HAM_PEACE:// [攻击模式: 全体攻击]
                            this.SendMsg(this, Grobal2.RM_CHANGEATTATCKMODE, 0, 0, 0, 0, GameMsgDef.sAttackModeOfPeaceful);// [攻击模式: 和平攻击]
                            this.SysMsg(GameMsgDef.sAttackModeOfPeaceful, TMsgColor.c_Green, TMsgType.t_Hint);
                            break;
                        case M2Share.HAM_DEAR:// [攻击模式: 和平攻击]
                            this.SendMsg(this, Grobal2.RM_CHANGEATTATCKMODE, 0, 0, 0, 0, GameMsgDef.sAttackModeOfDear);// [攻击模式: 夫妻攻击]
                            this.SysMsg(GameMsgDef.sAttackModeOfDear, TMsgColor.c_Green, TMsgType.t_Hint);
                            break;
                        case M2Share.HAM_MASTER:// [攻击模式: 夫妻攻击]
                            this.SendMsg(this, Grobal2.RM_CHANGEATTATCKMODE, 0, 0, 0, 0, GameMsgDef.sAttackModeOfMaster);// [攻击模式: 师徒攻击]
                            this.SysMsg(GameMsgDef.sAttackModeOfMaster, TMsgColor.c_Green, TMsgType.t_Hint);
                            break;
                        case M2Share.HAM_GROUP:// [攻击模式: 师徒攻击]
                            this.SendMsg(this, Grobal2.RM_CHANGEATTATCKMODE, 0, 0, 0, 0, GameMsgDef.sAttackModeOfGroup);// [攻击模式: 编组攻击]
                            this.SysMsg(GameMsgDef.sAttackModeOfGroup, TMsgColor.c_Green, TMsgType.t_Hint);
                            break;
                        case M2Share.HAM_GUILD:// [攻击模式: 编组攻击]
                            this.SendMsg(this, Grobal2.RM_CHANGEATTATCKMODE, 0, 0, 0, 0, GameMsgDef.sAttackModeOfGuild);// [攻击模式: 行会攻击]
                            this.SysMsg(GameMsgDef.sAttackModeOfGuild, TMsgColor.c_Green, TMsgType.t_Hint);
                            break;
                        case M2Share.HAM_PKATTACK:// [攻击模式: 行会攻击]
                            this.SendMsg(this, Grobal2.RM_CHANGEATTATCKMODE, 0, 0, 0, 0, GameMsgDef.sAttackModeOfRedWhite);// [攻击模式: 红名攻击]
                            this.SysMsg(GameMsgDef.sAttackModeOfRedWhite, TMsgColor.c_Green, TMsgType.t_Hint);// [攻击模式: 红名攻击]
                            break;
                    }
                    this.SysMsg(GameMsgDef.sStartChangeAttackModeHelp, TMsgColor.c_Green, TMsgType.t_Hint); // 使用组合快捷键 CTRL-H 更改攻击...
                    nCode = 21;
                    if (m_dwKillMonExpRateTime > 0) // 双倍经验时间内,进入游戏提示
                    {
                        this.SysMsg(string.Format(GameMsgDef.g_sChangeKillMonExpRateMsg, m_nKillMonExpRate / 100, m_dwKillMonExpRateTime), TMsgColor.c_Green, TMsgType.t_Hint);
                    }
                    nCode = 22;
                    if (GameConfig.boTestServer)
                    {
                        this.SysMsg(GameMsgDef.sStartNoticeMsg, TMsgColor.c_Green, TMsgType.t_Hint); // 欢迎进入本服务器进行游戏...
                    }
                    if (UserEngine.PlayObjectCount > GameConfig.nTestUserLimit)
                    {
                        if (this.m_btPermission < 2)
                        {
                            nCode = 23;
                            this.SysMsg(GameMsgDef.sOnlineUserFull, TMsgColor.c_Red, TMsgType.t_Hint);
                            this.SysMsg(GameMsgDef.sForceDisConnect, TMsgColor.c_Red, TMsgType.t_Hint);
                            m_boEmergencyClose = true;
                            m_boPlayOffLine = false;
                        }
                    }
                }
                nCode = 24;
                m_nBright = M2Share.g_nGameTime;
                this.m_Abil.MaxExp = this.GetLevelExp(this.m_Abil.Level);//登录重新取得升级所需经验值
                if (m_boTrainingNG)// 学过内功
                {
                    m_MaxExpSkill69 = this.GetSkill69Exp(m_NGLevel, ref m_Skill69MaxNH);// 登录重新取内功心法升级经验
                    this.SendNGData();
                }
                if (this.m_MagicList.Count > 0)
                {
                    for (int I = 0; I < this.m_MagicList.Count; I++)
                    {
                        UserMagic = (TUserMagic*)this.m_MagicList[I];
                        if (UserMagic != null)
                        {
                            if (HUtil32.SBytePtrToString(UserMagic->MagicInfo.sDescr, UserMagic->MagicInfo.DescrLen) == "连击")
                            {
                                this.m_boCanUseBatter = true;
                                break;
                            }
                        }
                    }
                }
                for (int I = 0; I <= 2; I++)
                {
                    n08 = this.m_nBatterOrder[I];
                    n09 = 0;
                    if ((n08 == 0) || (n08 == 2222))
                    {
                        continue;
                    }
                    if (this.m_MagicList.Count > 0)
                    {
                        for (int II = 0; II < this.m_MagicList.Count; II++)
                        {
                            UserMagic = (TUserMagic*)this.m_MagicList[II];
                            if (UserMagic != null)
                            {
                                if ((HUtil32.SBytePtrToString(UserMagic->MagicInfo.sDescr, UserMagic->MagicInfo.DescrLen) == "连击") && (UserMagic->MagicInfo.wMagicId == n08))
                                {
                                    this.m_boCanUseBatter = true;
                                    n09 = 8;
                                    break;
                                }
                            }
                        }
                    }
                    if (n09 != 8)
                    {
                        this.m_nBatterOrder[I] = 0; // 整理连击循序防止卡
                    }
                }
                nCode = 25;
                this.SendMsg(this, Grobal2.RM_ABILITY, 0, 0, 0, 0, "");
                this.SendMsg(this, Grobal2.RM_SUBABILITY, 0, 0, 0, 0, "");
                this.SendMsg(this, Grobal2.RM_ADJUST_BONUS, 0, 0, 0, 0, "");
                this.SendMsg(this, Grobal2.RM_DAYCHANGING, 0, 0, 0, 0, "");// 发送白天或晚上的状态
                this.SendMsg(this, Grobal2.RM_SENDUSEITEMS, 0, 0, 0, 0, "");// 发送使用的物品
                this.SendMsg(this, Grobal2.RM_SENDMYMAGIC, 0, 0, 0, 0, "");// 发送使用的魔法
                this.SendMsg(this, Grobal2.RM_PULSECHANGED, 0, 0, 0, 0, "");// 经络
                this.SendMsg(this, Grobal2.RM_BATTERORDER, 0, 0, 0, 0, "");// 连击技能循序
                this.SendMsg(this, Grobal2.RM_HEROATTECTMODE, 0, 0, 0, 0, "");// 副将英雄出战职业
                this.StormsRateChanged();
                this.OpenPulseNeedLevTabChanged();
                nCode = 26;
                if (m_MyHero != null)
                {
                    // 发送英雄信息 人物是离线挂机状态
                    this.SendDelayMsg(this, Grobal2.RM_RECALLHERO, 0, HUtil32.ObjectToInt(m_MyHero), 0, 0, "", 1000);
                    switch (((THeroObject)(m_MyHero)).m_btStatus)
                    {
                        case 1:
                            ((THeroObject)(m_MyHero)).SysMsg(GameMsgDef.g_sHeroFollow, TMsgColor.c_Green, TMsgType.t_Hint);
                            break;
                        case 0:
                            ((THeroObject)(m_MyHero)).SysMsg(GameMsgDef.g_sHeroAttack, TMsgColor.c_Green, TMsgType.t_Hint);
                            break;
                        case 2:
                            ((THeroObject)(m_MyHero)).SysMsg(GameMsgDef.g_sHeroRest, TMsgColor.c_Green, TMsgType.t_Hint);
                            break;
                    }
                    ((THeroObject)(m_MyHero)).SysMsg(GameMsgDef.g_sHeroLoginMsg, TMsgColor.c_Green, TMsgType.t_Hint);
                    if (((THeroObject)(m_MyHero)).m_nFirDragonPoint > GameConfig.nMaxFirDragonPoint)
                    {
                        ((THeroObject)(m_MyHero)).m_nFirDragonPoint = GameConfig.nMaxFirDragonPoint; //防止怒气调整后超过
                    }
                    ((THeroObject)(m_MyHero)).SendMsg(m_MyHero, Grobal2.RM_FIRDRAGONPOINT, GameConfig.nMaxFirDragonPoint, ((THeroObject)(m_MyHero)).m_nFirDragonPoint, 0, 0, "");// 发送英雄怒气值
                }
                nCode = 27;
                this.m_MyGuild = GuildManager.MemberOfGuild(this.m_sCharName);
                if (this.m_MyGuild != null)
                {
                    this.m_sGuildRankName = this.m_MyGuild.GetRankName(this, ref this.m_nGuildRankNo);
                    if (this.m_MyGuild.GuildWarList.Count > 0)
                    {
                        for (int I = 0; I < this.m_MyGuild.GuildWarList.Count; I++)
                        {
                            this.SysMsg(this.m_MyGuild.GuildWarList[I] + " 正在与本行会进行行会战。", TMsgColor.c_Green, TMsgType.t_Hint);
                        }
                    }
                }
                nCode = 28;
                this.RefShowName();
                if ((m_nPayMent == 1))
                {
                    if (!bo6AB)
                    {
                        this.SysMsg(GameMsgDef.sYouNowIsTryPlayMode, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    nCode = 29;
                    this.m_nGoldMax = GameConfig.nHumanTryModeMaxGold;
                    if (this.m_Abil.Level > GameConfig.nTryModeLevel)
                    {
                        this.SysMsg("测试状态可以使用到第 " + (GameConfig.nTryModeLevel).ToString() + " 级。", TMsgColor.c_Red, TMsgType.t_Hint);
                        this.SysMsg("链接中断，请到以下地址获得相关信息。(http://www.baidu.com)", TMsgColor.c_Red, TMsgType.t_Hint);
                        m_boEmergencyClose = true;
                        m_boPlayOffLine = false;
                    }
                }
                nCode = 30;
                if ((m_nPayMent == 3) && !bo6AB)
                {
                    this.SysMsg(GameMsgDef.g_sNowIsFreePlayMode, TMsgColor.c_Green, TMsgType.t_Hint);// '当前服务器运行于测试模式.'
                }
                if (GameConfig.boVentureServer)
                {
                    this.SysMsg("当前服务器运行于 不刷怪模式.", TMsgColor.c_Green, TMsgType.t_Hint);
                }
                if ((this.m_MagicErgumSkill != null) && (!this.m_boUseThrusting))
                {
                    this.m_boUseThrusting = true;
                    SendSocket(null, "+LNG");
                }
                nCode = 31;
                if (this.m_PEnvir.m_boNORECONNECT)
                {
                    this.MapRandomMove(this.m_PEnvir.sNoReconnectMap, 0);
                }
                nCode = 32;
                if (CheckDenyLogon())// 如果人物在禁止登录列表里则直接掉线而不执行下面内容
                {
                    m_boEmergencyClose = true;//修正禁止人物登陆不下线的问题
                    m_boPlayOffLine = false;
                    return;
                }
                // ==============================人物超过限制踢下线===========================
                nCode = 33;
                if (UserEngine.PlayObjectCount > UserEngine.m_nLimitUserCount)
                {
                    if (this.m_btPermission < 10)
                    {
                        m_boPlayOffLine = false;
                        m_boEmergencyClose = true;
                        return;
                    }
                }
                // ==============================================================================
                nCode = 34;
                if (M2Share.g_ManageNPC != null)
                {
                    M2Share.g_ManageNPC.GotoLable(this, "@Login", false);
                }
                nCode = 35;
                this.m_boFixedHideMode = false;
                if (m_sDearName != "")
                {
                    CheckMarry();
                }
                CheckMaster();
                nCode = 36;
                m_boFilterSendMsg = M2Share.GetDisableSendMsgList(this.m_sCharName);
                nCode = 37;
                if (GameConfig.boPasswordLockSystem) // 密码保护系统
                {
                    if (m_boPasswordLocked)
                    {
                        m_boCanGetBackItem = !GameConfig.boLockGetBackItemAction;
                    }
                    nCode = 38;
                    if (GameConfig.boLockHumanLogin && m_boLockLogon && m_boPasswordLocked)
                    {
                        m_boCanDeal = !GameConfig.boLockDealAction;
                        m_boCanDrop = !GameConfig.boLockDropAction;
                        m_boCanUseItem = !GameConfig.boLockUserItemAction;
                        m_boCanWalk = !GameConfig.boLockWalkAction;
                        m_boCanRun = !GameConfig.boLockRunAction;
                        m_boCanHit = !GameConfig.boLockHitAction;
                        m_boCanSpell = !GameConfig.boLockSpellAction;
                        m_boCallHero = !GameConfig.boLockCallHeroAction;// 是否锁定召唤英雄操作 
                        m_boCanSendMsg = !GameConfig.boLockSendMsgAction;
                        this.m_boObMode = GameConfig.boLockInObModeAction;
                        nCode = 39;
                        this.SysMsg(GameMsgDef.g_sActionIsLockedMsg + " 开锁命令: @" + M2Share.g_GameCommand.UnLock.sCmd, TMsgColor.c_Red, TMsgType.t_Hint);
                        this.SendMsg(M2Share.g_ManageNPC, Grobal2.RM_MENU_OK, 0, HUtil32.ObjectToInt(this), 0, 0, GameMsgDef.g_sActionIsLockedMsg + "\\ \\" + "开锁命令: @"
                            + M2Share.g_GameCommand.UnLock.sCmd + "\\" + "加锁命令: @" + M2Share.g_GameCommand.__Lock.sCmd + "\\" + "设置密码命令: @"
                            + M2Share.g_GameCommand.SETPASSWORD.sCmd + "\\" + "修改密码命令: @" + M2Share.g_GameCommand.CHGPASSWORD.sCmd);
                    }
                }
                nCode = 40;// 重置泡点方面计时
                m_dwIncGamePointTick = HUtil32.GetTickCount();
                m_dwIncGameGoldTick = HUtil32.GetTickCount();
                m_dwAutoGetExpTick = HUtil32.GetTickCount();
                nCode = 31;
                GetSellOffGlod();// 检查是否有元宝寄售交易结束还没得到元宝
                nCode = 32;
                IsItem_51(1);// 发送聚灵珠的经验
                if ((this.m_btMagBubbleDefenceLevel == 4) && (this.m_dwStatusArrTick[Grobal2.STATE_BUBBLEDEFENCEUP] > 0))
                {
                    this.StatusChanged("444"); // 4级盾,发个消息给客户端显示特有的效果;
                }
            }
            catch
            {
                M2Share.MainOutMessage(sExceptionMsg + " Name:" + this.m_sCharName + "  Code:" + nCode);
            }
        }

        // --------双英雄相关--------//
        private void HeroAutoTraining()
        {
        }

        // 客户端发送确定评定副将英雄
        private void ClientAssessHero()
        {
            if (AssessHeroDataInfo[0].IsMain)
            {
                sName1 = AssessHeroDataInfo[0].HeroDataInfo.sChrName;
                sName2 = AssessHeroDataInfo[1].HeroDataInfo.sChrName;
            }
            else if (AssessHeroDataInfo[1].IsMain)
            {
                sName2 = AssessHeroDataInfo[0].HeroDataInfo.sChrName;
                sName1 = AssessHeroDataInfo[1].HeroDataInfo.sChrName;
            }
            M2Share.FrontEngine.AddToLoadHeroRcdList("", sName1 + "/" + sName2, this, 5);
        }

        // 确定评定主副将英雄
        private void ClientQueryAssessHero()
        {
            THeroDataInfo cu;
            string s1;
            string s2;
            //ZeroMemory(cu, sizeof(THeroDataInfo));
            if (m_sAssessHeroMsg != "")
            {
                s1 = m_sAssessHeroMsg;
                for (int I = 0; I <= 1; I++)
                {
                    //s1 = HUtil32.GetValidStr3(s1, ref s2, new string[] { "/" });
                    //DecodeBuffer(s2, cu, sizeof(THeroDataInfo));
                    //AssessHeroDataInfo[I].HeroDataInfo = cu;
                }
            }
            if ((AssessHeroDataInfo[0].HeroDataInfo.sChrName != "") && (AssessHeroDataInfo[1].HeroDataInfo.sChrName != ""))
            {
                if (AssessHeroDataInfo[0].HeroDataInfo.Level > AssessHeroDataInfo[1].HeroDataInfo.Level)
                {
                    AssessHeroDataInfo[0].IsMain = true;
                    AssessHeroDataInfo[1].IsMain = false;
                }
                else
                {
                    AssessHeroDataInfo[0].IsMain = false;
                    AssessHeroDataInfo[1].IsMain = true;
                }
            }
            //this.SendMsg(this, Grobal2.RM_QUERYASSESSHERO, 0, 0, 0, 0, EncryptUnit.EncodeBuffer(AssessHeroDataInfo[0], sizeof(TAssessHeroDataInfo)) + "/" + EncryptUnit.EncodeBuffer(AssessHeroDataInfo[1], sizeof(TAssessHeroDataInfo)));
        }

        // -------连击相关-------//
        private void ClientQueryOpenPulse(ushort PulsePage, ushort OpenPulse, bool IsHero)
        {
            if (M2Share.g_BatterNPC != null)
            {
                if (IsHero)
                {
                    if (m_MyHero != null)
                    {
                        M2Share.g_BatterNPC.GotoLable(this, "@HeroPulse" + (PulsePage).ToString() + "-" + (OpenPulse).ToString(), false);
                    }
                }
                else
                {
                    M2Share.g_BatterNPC.GotoLable(this, "@Pulse" + (PulsePage).ToString() + "-" + (OpenPulse).ToString(), false);
                }
            }
        }

        private void ClientRushPulse(ushort PulsePage, ushort RushLevel, bool IsHero)
        {
            if ((PulsePage >= 0 && PulsePage <= 3) && (RushLevel >= 1 && RushLevel <= 5))
            {
                if (IsHero)
                {
                    if (m_MyHero != null)// 英雄经络
                    {
                        if (m_MyHero.m_HumPulses[PulsePage].PulseLevel == RushLevel - 1)
                        {
                            if (M2Share.g_BatterNPC != null)
                            {
                                M2Share.g_BatterNPC.GotoLable(this, "@Hero修炼" + PulsePage + "-" + (RushLevel - 1).ToString(), false);
                            }
                        }
                    }
                }
                else
                {
                    if (this.m_HumPulses[PulsePage].PulseLevel == RushLevel - 1)
                    {
                        if (M2Share.g_BatterNPC != null)
                        {
                            M2Share.g_BatterNPC.GotoLable(this, "@经络修炼" + PulsePage + "-" + (RushLevel - 1).ToString(), false);
                        }
                    }
                }
            }
        }

        public unsafe void ClientUseBatter_GetRandomOrder()
        {
            ArrayList List = null;
            TUserMagic* UserMagic;
            int K;
            try
            {
                for (int I = 0; I <= 2; I++)
                {
                    this.bOrder[I] = this.m_nBatterOrder[I];
                }
                List = new ArrayList();
                for (int I = 0; I < this.m_MagicList.Count; I++)
                {
                    UserMagic = (TUserMagic*)this.m_MagicList[I];
                    if ((UserMagic != null) && (HUtil32.SBytePtrToString(UserMagic->MagicInfo.sDescr, UserMagic->MagicInfo.DescrLen) == "连击")
                        && (UserMagic->MagicInfo.btJob == this.m_btJob))
                    {
                        List.Add(UserMagic->wMagIdx);
                    }
                }
                for (int I = List.Count - 1; I >= 0; I--)
                {
                    for (int J = 0; J <= 2; J++)
                    {
                        if (((int)List[I]) == this.bOrder[J])
                        {
                            List.RemoveAt(I);
                            break;
                        }
                    }
                }
                for (int I = 0; I <= 2; I++)
                {
                    if (this.bOrder[I] == 2222)
                    {
                        if (List.Count > 0)
                        {
                            K = HUtil32.Random(List.Count - 1);
                            if (K >= 0)
                            {
                                this.bOrder[I] = ((byte)List[K]);
                                List.RemoveAt(K);
                            }
                        }
                    }
                }
            }
            finally
            {
                Dispose(List);
            }
        }

        public void ClientUseBatter_ExitBatter()
        {
            m_boCanWalk = true;
            m_boCanRun = true;
            m_boCanHit = true;
            m_boCanSpell = true;
            this.m_boUseBatter = false;
            this.SendMsg(this, Grobal2.RM_BATTERUSEFINALLY, 0, 0, 0, 0, "");
        }

        /// <summary>
        /// 使用连击
        /// </summary>
        /// <param name="ProcessMessage"></param>
        public void ClientUseBatter(TProcessMessage ProcessMessage)
        {
            uint dwTime = 0;
            if (this.m_nBatter == 0)
            {
                ClientUseBatter_GetRandomOrder();
                this.m_nBatterSpellTick = HUtil32.GetTickCount() - 1500;
                this.m_boBatterFinally = true;
            }
            if (this.m_boBatterFinally && ((this.m_btJob == 0) || (HUtil32.GetTickCount() - this.m_nBatterSpellTick > 1200)))
            {
                if (this.m_nBatter > 2)
                {
                    ClientUseBatter_ExitBatter();
                    return;
                }
                if (this.bOrder[this.m_nBatter] == 0)
                {
                    ClientUseBatter_ExitBatter();
                    return;
                }
                this.m_nBatterSpellTick = HUtil32.GetTickCount();
                switch (this.m_btJob)
                {
                    case 0:
                    case 3:
                        this.m_boBatterFinally = false;
                        this.m_nBatterUseTick = HUtil32.GetTickCount();
                        ClientSpellXY((ushort)this.bOrder[this.m_nBatter], 0, 0, 0, null, true, ref dwTime);
                        break;
                    case 1:
                    case 2:
                        this.m_boBatterFinally = false;
                        m_boCanWalk = false;
                        m_boCanRun = false;
                        m_boCanHit = false;
                        m_boCanSpell = false;
                        if (this.m_nBatterTarget != null)
                        {
                            ClientSpellXY((ushort)this.bOrder[this.m_nBatter], 0, this.m_nBatterX, this.m_nBatterY, this.m_nBatterTarget, true, ref dwTime);
                        }
                        else
                        {
                            ClientSpellXY((ushort)this.bOrder[this.m_nBatter], 0, this.m_nBatterX, this.m_nBatterY, null, true, ref dwTime);
                        }
                        break;
                }
                this.m_nBatter++;
            }
        }

        /// <summary>
        /// 向客户端发送游戏币,游戏点,金刚石,灵符数量
        /// </summary>
        /// <param name="boSendName"></param>
        private void SendGoldInfo(bool boSendName)
        {
            string sMsg = string.Empty;
            if (boSendName)
            {
                sMsg = GameConfig.sGameGoldName + '\r' + GameConfig.sGamePointName + '\r' + GameConfig.sGameDiaMond + '\r' + GameConfig.sGameGird;
            }
            SendDefMessage(Grobal2.SM_GAMEGOLDNAME, m_nGameGold, m_nGamePoint, m_nGAMEDIAMOND, m_nGAMEGIRD, sMsg);
        }

        /// <summary>
        /// 发送荣誉值
        /// </summary>
        private void SendGloryInfo()
        {
            SendDefMessage(Grobal2.SM_GLORY, m_btGameGlory, 0, 0, 0, "");
        }

        /// <summary>
        /// 发送登录
        /// </summary>
        private unsafe void SendLogon()
        {
            TMessageBodyWL MessageBodyWL;
            int nRecog;
            byte[] data;
            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_LOGON, this.ToInt(), this.m_nCurrX, this.m_nCurrY,
                (short)HUtil32.MakeWord((byte)this.m_btDirection, (byte)this.m_nLight), 0);
            MessageBodyWL.lParam1 = this.GetFeatureToLong();// 人物着装
            MessageBodyWL.lParam2 = this.m_nCharStatus;// 人物状态
            m_boAllowGroup = false;//人物上线自动关组
            MessageBodyWL.lTag1 = 0;
            MessageBodyWL.lTag2 = 0;
            data = new byte[sizeof(TMessageBodyWL)];
            fixed (byte* pb = data)
            {
                *(TMessageBodyWL*)pb = MessageBodyWL;
            }
            nRecog = this.GetFeatureToLong();
            SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TMessageBodyWL)));
            SendDefMessage(Grobal2.SM_FEATURECHANGED, this.ToInt(), nRecog, nRecog, this.GetFeatureEx(), "");
        }

        /// <summary>
        /// 发送服务器配置信息(客户端相关)
        /// </summary>
        public unsafe void SendServerConfig()
        {
            int nRecog;
            int nParam;
            string sMsg;
            TClientConf ClientConf;
            if (m_nSoftVersionDateEx == 0)
            {
                return;
            }
            byte nRunHuman = 0;
            byte nRunMon = 0;
            byte nRunNpc = 0;
            byte nWarRunAll = 0;
            if (GameConfig.boDiableHumanRun || ((this.m_btPermission > 9) && GameConfig.boGMRunAll) || (GameConfig.boSafeAreaLimited && this.InSafeZone()))
            {
                nRunHuman = 1;
                nRunMon = 1;
                nRunNpc = 1;
                nWarRunAll = 1;
            }
            else
            {
                if (GameConfig.boRUNHUMAN || this.m_PEnvir.m_boRUNHUMAN)
                {
                    nRunHuman = 1;
                }
                if (GameConfig.boRUNMON || this.m_PEnvir.m_boRUNMON)
                {
                    nRunMon = 1;
                }
                if (GameConfig.boRunNpc)
                {
                    nRunNpc = 1;
                }
                if (GameConfig.boWarDisHumRun)
                {
                    nWarRunAll = 1;
                }
            }
            ClientConf = GameConfig.ClientConf;
            ClientConf.boRUNHUMAN = nRunHuman == 1;
            ClientConf.boRUNMON = nRunMon == 1;
            ClientConf.boRunNpc = nRunNpc == 1;
            ClientConf.boWarRunAll = nWarRunAll == 1;
            ClientConf.wSpellTime = Convert.ToUInt16(GameConfig.dwMagicHitIntervalTime + 300);
            ClientConf.wHitIime = Convert.ToUInt16(GameConfig.dwHitIntervalTime + 500);//攻击速度
            ClientConf.boSkill31Effect = GameConfig.boSkill31Effect;// 魔法盾效果 T-特色效果 F-盛大效果
            sMsg = EncryptUnit.EncodeBuffer(&ClientConf, sizeof(TClientConf));
            nRecog = HUtil32.MakeLong(HUtil32.MakeWord(nRunHuman, nRunMon), HUtil32.MakeWord(nRunNpc, nWarRunAll));
            nParam = HUtil32.MakeWord(ClientConf.btDieColor, 0);
            SendDefMessage(Grobal2.SM_SERVERCONFIG, nRecog, nParam, 0, 0, sMsg);
        }

        /// <summary>
        /// 发送物品解包数据
        /// </summary>
        private unsafe void SendUnBind()
        {
            string sMsg = "";
            TUnbindInfo* UnbindInfo;
            if (M2Share.g_UnbindList.Count > 0)
            {
                byte[] data;
                foreach (var item in M2Share.g_UnbindList)
                {
                    UnbindInfo = (TUnbindInfo*)item;
                    sMsg = sMsg + EncryptUnit.EncodeBuffer(UnbindInfo, sizeof(TUnbindInfo)) + "/";
                }
            }
            if (sMsg != "")
            {
                TDefaultMessage msg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SERVERUNBIND, 0, 0, 0, 0, 0);
                SendSocket(msg, sMsg);//修正发送消息错误，导致客户端认为是发送服务端配置消息，造成玩家无法多次攻击目标
            }
        }

        private void SendServerStatus()
        {
            if (this.m_btPermission < 10)
            {
                return;
            }
            // this.SysMsg((EDcodeUnit.Units.EDcodeUnit.CalcFileCRC(System.Environment.GetCommandLineArgs()[0])).ToString(), TMsgColor.c_Red, TMsgType.t_Hint);
        }

        /// <summary>
        /// 发送使用的物品
        /// </summary>
        public unsafe void SendUseitems()
        {
            TStdItem* Item;
            string sSENDMSG = string.Empty;
            TClientItem* ClientItem = null;
            TOClientItem* OClientItem = null;
            TStdItem* StdItem;
            string sUserItemName;
            if ((m_nSoftVersionDateEx == 0) && (m_dwClientTick == 0))
            {
                for (int I = m_UseItems.GetLowerBound(0); I <= m_UseItems.GetUpperBound(0); I++)
                {
                    if (this.m_UseItems[I]->wIndex > 0)
                    {
                        Item = UserEngine.GetStdItem(this.m_UseItems[I]->wIndex);
                        if (Item != null)
                        {
                            StdItem = Item;
                            ItemUnit.GetItemAddValue(this.m_UseItems[I], StdItem);
                            M2Share.CopyStdItemToOStdItem(StdItem, &OClientItem->s);  // 取自定义物品名称
                            sUserItemName = "";
                            if (this.m_UseItems[I]->btValue[13] == 1)
                            {
                                sUserItemName = ItemUnit.GetCustomItemName(this.m_UseItems[I]->MakeIndex, this.m_UseItems[I]->wIndex);
                            }
                            if (sUserItemName != "")
                            {
                                HUtil32.StrToSByteArry(sUserItemName, OClientItem->s.Name, 14, ref OClientItem->s.NameLen);
                                //OClientItem->s->Name = sUserItemName;
                            }
                            OClientItem->Dura = this.m_UseItems[I]->Dura;
                            OClientItem->DuraMax = this.m_UseItems[I]->DuraMax;
                            OClientItem->MakeIndex = this.m_UseItems[I]->MakeIndex;
                            byte[] data = new byte[sizeof(TOClientItem)];
                            fixed (byte* pb = data)
                            {
                                *(TOClientItem*)pb = *OClientItem;
                            }
                            sSENDMSG = sSENDMSG + I + "/" + EncryptUnit.EncodeBuffer(data, sizeof(TOClientItem)) + "/";
                        }
                    }
                }
                if (sSENDMSG != "")
                {
                    this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SENDUSEITEMS, 0, 0, 0, 0, 0);
                    SendSocket(this.m_DefMsg, sSENDMSG);
                }
            }
            else
            {
                for (int I = m_UseItems.GetLowerBound(0); I <= m_UseItems.GetUpperBound(0); I++)
                {
                    if (this.m_UseItems[I]->wIndex > 0)
                    {
                        Item = UserEngine.GetStdItem(this.m_UseItems[I]->wIndex);
                        if (Item != null)
                        {
                            StdItem = Item;
                            ItemUnit.GetItemAddValue(this.m_UseItems[I], StdItem);
                            ClientItem = (TClientItem*)Marshal.AllocHGlobal(sizeof(TClientItem));
                            ClientItem->s = *StdItem;
                            sUserItemName = "";// 取自定义物品名称
                            if (this.m_UseItems[I]->btValue[13] == 1)
                            {
                                sUserItemName = ItemUnit.GetCustomItemName(this.m_UseItems[I]->MakeIndex, this.m_UseItems[I]->wIndex);
                            }
                            if (sUserItemName != "")
                            {
                                HUtil32.StrToSByteArry(sUserItemName, ClientItem->s.Name, 14, ref ClientItem->s.NameLen);
                            }
                            if (this.m_UseItems[I]->btValue[12] == 1) // 物品发光
                            {
                                ClientItem->s.Reserved1 = 1;
                            }
                            else
                            {
                                ClientItem->s.Reserved1 = 0;
                            }
                        }
                        ClientItem->Dura = this.m_UseItems[I]->Dura;
                        ClientItem->DuraMax = this.m_UseItems[I]->DuraMax;
                        ClientItem->MakeIndex = this.m_UseItems[I]->MakeIndex;
                        sSENDMSG = sSENDMSG + I + "/" + EncryptUnit.EncodeBuffer(ClientItem, Marshal.SizeOf(typeof(TClientItem))) + "/";
                    }
                }
                if (sSENDMSG != "")
                {
                    this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SENDUSEITEMS, 0, 0, 0, 0, 0);
                    SendSocket(this.m_DefMsg, sSENDMSG);
                }
            }
        }

        /// <summary>
        /// 发送使用的魔法
        /// </summary>
        private unsafe void SendUseMagic()
        {
            string sSENDMSG = "";
            TUserMagic* UserMagic;
            TClientMagic* ClientMagic = null;
            if (this.m_MagicList.Count > 0)
            {
                for (int I = 0; I < this.m_MagicList.Count; I++)
                {
                    UserMagic = (TUserMagic*)this.m_MagicList[I];
                    if (UserMagic != null)
                    {
                        ClientMagic = (TClientMagic*)Marshal.AllocHGlobal(sizeof(TClientMagic));
                        ClientMagic->Key = (char)(UserMagic->btKey);
                        ClientMagic->Level = UserMagic->btLevel;
                        ClientMagic->CurTrain = UserMagic->nTranPoint;
                        ClientMagic->Def = UserMagic->MagicInfo;
                        byte[] data = new byte[sizeof(TClientMagic)];
                        fixed (byte* pb = data)
                        {
                            *(TClientMagic*)pb = *ClientMagic;
                        }
                        sSENDMSG = sSENDMSG + EncryptUnit.EncodeBuffer(data, sizeof(TClientMagic)) + "/";
                    }
                }
            }
            if (sSENDMSG != "")
            {
                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SENDMYMAGIC, 0, 0, 0, this.m_MagicList.Count, 0);
                SendSocket(this.m_DefMsg, sSENDMSG);
            }
        }
       
        /// <summary>
        /// 客户端改变方向
        /// </summary>
        /// <param name="wIdent"></param>
        /// <param name="nX"></param>
        /// <param name="nY"></param>
        /// <param name="nDir"></param>
        /// <param name="dwDelayTime"></param>
        /// <returns></returns>
        private bool ClientChangeDir(int wIdent, int nX, int nY, int nDir, ref uint dwDelayTime)
        {
            bool result = false;
            uint dwCheckTime;
            if (this.m_boDeath || (this.m_wStatusTimeArr[Grobal2.POISON_STONE] != 0))// 防麻
            {
                return result;
            }
            if (!CheckActionStatus(wIdent, ref dwDelayTime))
            {
                m_boFilterAction = false;
                return result;
            }
            m_boFilterAction = true;
            dwCheckTime = HUtil32.GetTickCount() - m_dwTurnTick;
            if (dwCheckTime < GameConfig.dwTurnIntervalTime)
            {
                dwDelayTime = GameConfig.dwTurnIntervalTime - dwCheckTime;
                return result;
            }
            if ((nX == this.m_nCurrX) && (nY == this.m_nCurrY))
            {
                this.m_btDirection = (byte)nDir;
                if (this.Walk(Grobal2.RM_TURN))
                {
                    m_dwTurnTick = HUtil32.GetTickCount();
                    result = true;
                }
            }
            return result;
        }

        /// <summary>
        /// 客户端蹲下的动作
        /// </summary>
        /// <param name="nX"></param>
        /// <param name="nY"></param>
        /// <param name="nDir"></param>
        /// <param name="dwDelayTime"></param>
        /// <returns></returns>
        private bool ClientSitDownHit(int nX, int nY, int nDir, ref uint dwDelayTime)
        {
            bool result = false;
            uint dwCheckTime;
            if (this.m_boDeath || (this.m_wStatusTimeArr[Grobal2.POISON_STONE] != 0))// 防麻
            {
                return result;
            }
            dwCheckTime = HUtil32.GetTickCount() - m_dwTurnTick;
            if (dwCheckTime < GameConfig.dwTurnIntervalTime)
            {
                dwDelayTime = GameConfig.dwTurnIntervalTime - dwCheckTime;
                return result;
            }
            m_dwTurnTick = HUtil32.GetTickCount();
            this.SendRefMsg(Grobal2.RM_POWERHIT, 0, 0, 0, 0, "");
            result = true;
            return result;
        }

        /// <summary>
        /// 开门,人物走到地图的某个过门点时
        /// </summary>
        /// <param name="nX"></param>
        /// <param name="nY"></param>
        private void ClientOpenDoor(int nX, int nY)
        {
            TDoorInfo Door = this.m_PEnvir.GetDoor(nX, nY);
            TUserCastle Castle;
            if (Door == null)
            {
                return;
            }
            Castle = M2Share.g_CastleManager.IsCastleEnvir(this.m_PEnvir);
            if ((Castle == null) || (Castle.m_DoorStatus != Door.Status) || (this.m_btRaceServer != Grobal2.RC_PLAYOBJECT)
                || Castle.CheckInPalace(this.m_nCurrX, this.m_nCurrY, this))
            {
                UserEngine.OpenDoor(this.m_PEnvir, nX, nY);
            }
        }

        /// <summary>
        /// 取能走的坐标
        /// </summary>
        /// <param name="nDir"></param>
        /// <param name="nX"></param>
        /// <param name="nY"></param>
        /// <returns></returns>
        public bool MakeHero_GetGotoXY(int nDir, ref int nX, ref int nY)
        {
            bool result;
            byte n01;
            int nTargetX;
            int nTargetY;
            result = false;
            n01 = 0;
            nTargetX = nX;
            nTargetY = nY;
            while (true)
            {
                switch (nDir)
                {
                    case Grobal2.DR_UP:// 北
                        if (this.m_PEnvir.CanWalk(nTargetX, nTargetY, false))
                        {
                            result = true;
                            break;
                        }
                        else
                        {
                            if (n01 >= 3)
                            {
                                break;
                            }
                            nTargetY -= 2;
                            n01++;
                            continue;
                        }
                    case Grobal2.DR_UPRIGHT:// 东北
                        if (this.m_PEnvir.CanWalk(nTargetX, nTargetY, false))
                        {
                            result = true;
                            break;
                        }
                        else
                        {
                            if (n01 >= 3)
                            {
                                break;
                            }
                            nTargetX += 2;
                            nTargetY -= 2;
                            n01++;
                            continue;
                        }
                    case Grobal2.DR_RIGHT:// 东
                        if (this.m_PEnvir.CanWalk(nTargetX, nTargetY, false))
                        {
                            result = true;
                            break;
                        }
                        else
                        {
                            if (n01 >= 3)
                            {
                                break;
                            }
                            nTargetX += 2;
                            n01++;
                            continue;
                        }
                    case Grobal2.DR_DOWNRIGHT:// 东南
                        if (this.m_PEnvir.CanWalk(nTargetX, nTargetY, false))
                        {
                            result = true;
                            break;
                        }
                        else
                        {
                            if (n01 >= 3)
                            {
                                break;
                            }
                            nTargetX += 2;
                            nTargetY += 2;
                            n01++;
                            continue;
                        }
                    case Grobal2.DR_DOWN:// 南
                        if (this.m_PEnvir.CanWalk(nTargetX, nTargetY, false))
                        {
                            result = true;
                            break;
                        }
                        else
                        {
                            if (n01 >= 3)
                            {
                                break;
                            }
                            nTargetY += 1;
                            n01++;
                            continue;
                        }
                    case Grobal2.DR_DOWNLEFT:// 西南
                        if (this.m_PEnvir.CanWalk(nTargetX, nTargetY, false))
                        {
                            result = true;
                            break;
                        }
                        else
                        {
                            if (n01 >= 3)
                            {
                                break;
                            }
                            nTargetX -= 2;
                            nTargetY += 2;
                            n01++;
                            continue;
                        }
                    case Grobal2.DR_LEFT:// 西
                        if (this.m_PEnvir.CanWalk(nTargetX, nTargetY, false))
                        {
                            result = true;
                            break;
                        }
                        else
                        {
                            if (n01 >= 3)
                            {
                                break;
                            }
                            nTargetX -= 2;
                            n01++;
                            continue;
                        }
                    case Grobal2.DR_UPLEFT:// 西北向
                        if (this.m_PEnvir.CanWalk(nTargetX, nTargetY, false))
                        {
                            result = true;
                            break;
                        }
                        else
                        {
                            if (n01 >= 3)
                            {
                                break;
                            }
                            nTargetX -= 2;
                            nTargetY -= 2;
                            n01++;
                            continue;
                        }
                    default:
                        break;
                }
                nX = nTargetX;
                nY = nTargetY;
                return result;
            }
        }

        /// <summary>
        /// 创建英雄
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="HumanRcd"></param>
        /// <returns></returns>
        public unsafe TBaseObject MakeHero(TPlayObject PlayObject, THumDataInfo* HumanRcd)
        {
            TBaseObject result = null;
            int nX = 0;
            int nY = 0;
            int n1C = 0;
            int n10 = 0;
            TBaseObject MonObj;
            byte nCode = 0;
            try
            {
                this.GetFrontPosition(ref nX, ref nY);
                nCode = 1;
                if ((((PlayObject.m_sHeroCharName).ToLower().CompareTo((HUtil32.SBytePtrToString(HumanRcd->Data.sChrName, 0, HumanRcd->Data.ChrNameLen)).ToLower()) != 0)
                    && ((PlayObject.m_sDeputyHeroCharName).ToLower().CompareTo((HUtil32.SBytePtrToString(HumanRcd->Data.sChrName, 0, HumanRcd->Data.ChrNameLen)).ToLower()) != 0)) ||
                    (!HumanRcd->Header.boIsHero) || (HumanRcd->Header.boDeleted))
                {
                    return result;
                }
                nCode = 2;
                while (true)
                {
                    if (!this.m_PEnvir.CanWalk(nX, nY, false))// 如果坐标无法走，则取主人的方向，计算可以走到的坐标上
                    {
                        this.GetFrontPosition(ref nX, ref nY);
                        n10 = (this.m_btDirection + n1C) % 8;
                        MakeHero_GetGotoXY(n10, ref nX, ref nY);
                    }
                    else
                    {
                        break;
                    }
                    n1C++;
                    if (n1C >= 9)
                    {
                        break;
                    }
                }
                MonObj = UserEngine.RegenMyHero(PlayObject, nX, nY, HumanRcd);
                if (MonObj != null)
                {
                    nCode = 3;
                    MonObj.m_Master = this;
                    MonObj.m_dwMasterRoyaltyTick = 1000000; // 1000 * 1000
                    MonObj.m_dwMasterRoyaltyTime = HUtil32.GetTickCount();
                    MonObj.m_btSlaveMakeLevel = (byte)this.m_Abil.Level;
                    MonObj.m_btSlaveExpLevel = (byte)this.m_Abil.MaxExp;
                    nCode = 4;
                    MonObj.RecalcAbilitys();
                    nCode = 5;
                    MonObj.CompareSuitItem(false);// 套装
                    if (MonObj.m_WAbil.HP <= 0)
                    {
                        MonObj.m_WAbil.HP = (MonObj.m_WAbil.MaxHP / 15) + 2;
                    }
                    nCode = 6;
                    MonObj.RefNameColor();// 刷新名字颜色
                    nCode = 7;
                    if (MonObj.m_Master != null) // 修正面对墙壁，障碍物，召唤英雄时，英雄会离主人很远，如超过4格，则飞到主人身旁
                    {
                        nCode = 8;
                        if ((Math.Abs(MonObj.m_nCurrX - MonObj.m_Master.m_nCurrX) > 4) || (Math.Abs(MonObj.m_nCurrY - MonObj.m_Master.m_nCurrY) > 4))
                        {
                            nCode = 9;
                            MonObj.SpaceMove(MonObj.m_Master.m_PEnvir.sMapName, MonObj.m_Master.m_nCurrX, MonObj.m_Master.m_nCurrY, 1);
                        }
                    }
                    result = MonObj;
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.MakeHero Code:" + nCode);
            }
            return result;
        }

        /// <summary>
        /// 召唤英雄
        /// </summary>
        public void ClientRecallHero()
        {
            // 死亡不能再召唤英雄
            if (m_boWaitHeroDate || this.m_boDeath || this.m_boGhost)
            {
                return;
            }
            // 不能召唤英雄
            if (!m_boCallHero)
            {
                return;
            }
            if (m_MyHero != null)
            {
                if (m_MyHero.m_boDeath || m_MyHero.m_boGhost)
                {
                    m_MyHero = null;
                }
            }
            m_boHeroLogOut = false;// 英雄退出
            if (m_MyHero != null)
            {
                this.SendUpdateMsg(this, Grobal2.RM_RECALLHERO, 0, m_MyHero.ToInt(), 0, 0, "");
                return;
            }
            if (n_HeroSave != 1)
            {
                if ((!m_boHasHero || !m_boHasHeroTwo) && (m_sHeroCharName == ""))
                {
                    //this.SysMsg(GameMsgDef.g_sNotHero, c_Red, t_Hint); //您还没有创建英雄！！！
                }
                else
                {
                    if ((HUtil32.GetTickCount() - m_nRecallHeroTime) > 900) //限制召唤过快
                    {
                        if ((HUtil32.GetTickCount() - m_nRecallHeroTime) > GameConfig.nRecallHeroTime)// 召唤英雄间隔
                        {
                            m_nRecallHeroTime = HUtil32.GetTickCount();// 召唤英雄间隔
                            M2Share.FrontEngine.AddToLoadHeroRcdList(m_sHeroCharName, "", this, 0);
                        }
                        else
                        {
                            // 召唤英雄间隔
                            this.SysMsg(string.Format(GameMsgDef.g_sRecallHeroHint, (GameConfig.nRecallHeroTime - (HUtil32.GetTickCount() - m_nRecallHeroTime)) / 1000), TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                    }
                }
            }
            else
            {
                if (m_sHeroCharName != "")
                {
                    if ((HUtil32.GetTickCount() - m_nRecallHeroTime) > 900)// 限制召唤过快
                    {
                        if ((HUtil32.GetTickCount() - m_nRecallHeroTime) > GameConfig.nRecallHeroTime)// 召唤英雄间隔
                        {
                            m_nRecallHeroTime = HUtil32.GetTickCount(); // 召唤英雄间隔
                            M2Share.FrontEngine.AddToLoadHeroRcdList(m_sHeroCharName, "", this, 0);
                        }
                        else
                        {
                            // 召唤英雄间隔
                            this.SysMsg(string.Format(GameMsgDef.g_sRecallHeroHint, (GameConfig.nRecallHeroTime - (HUtil32.GetTickCount() - m_nRecallHeroTime)) / 1000), TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                    }
                }
            }
        }

        public void ClientRecallDeputyHero()
        {
            if (m_boWaitHeroDate || this.m_boDeath || this.m_boGhost)// 死亡不能再召唤英雄
            {
                return;
            }
            if (!m_boCallHero) // 不能召唤英雄
            {
                return;
            }
            if (m_MyHero != null)
            {
                return;
            }
            m_boHeroLogOut = false; // 英雄退出
            if (n_HeroSave != 1)
            {
                if ((!m_boHasHero || !m_boHasHeroTwo) && (m_sDeputyHeroCharName == ""))
                {
                    //this.SysMsg(GameMsgDef.g_sNotHero, c_Red, t_Hint); //您还没有创建英雄！！！
                }
                else
                {
                    if ((HUtil32.GetTickCount() - m_nRecallDeputyHeroTime) > 900)// 限制召唤过快
                    {
                        if ((HUtil32.GetTickCount() - m_nRecallDeputyHeroTime) > GameConfig.RecallDeputyHeroTime)// 召唤英雄间隔
                        {
                            m_nRecallDeputyHeroTime = HUtil32.GetTickCount();// 召唤英雄间隔
                            M2Share.FrontEngine.AddToLoadHeroRcdList(m_sDeputyHeroCharName, "", this, 4);
                        }
                        else
                        {
                            // 召唤英雄间隔
                            this.SysMsg(string.Format(GameMsgDef.g_sRecallHeroHint, (GameConfig.RecallDeputyHeroTime -
                                (HUtil32.GetTickCount() - m_nRecallDeputyHeroTime)) / 1000), TMsgColor.c_Red, TMsgType.t_Hint);
                        }

                    }
                }
            }
            else
            {
                if (m_sDeputyHeroCharName != "")
                {
                    if ((HUtil32.GetTickCount() - m_nRecallDeputyHeroTime) > 900)// 限制召唤过快
                    {
                        if ((HUtil32.GetTickCount() - m_nRecallDeputyHeroTime) > GameConfig.RecallDeputyHeroTime)// 召唤英雄间隔
                        {
                            m_nRecallDeputyHeroTime = HUtil32.GetTickCount();// 召唤英雄间隔
                            M2Share.FrontEngine.AddToLoadHeroRcdList(m_sDeputyHeroCharName, "", this, 4);
                        }
                        else
                        {
                            // 召唤英雄间隔
                            this.SysMsg(string.Format(GameMsgDef.g_sRecallHeroHint, (GameConfig.RecallDeputyHeroTime - (HUtil32.GetTickCount() - m_nRecallDeputyHeroTime)) / 1000), TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                    }
                }
            }
        }

        /// <summary>
        /// 客户端英雄退出
        /// </summary>
        /// <param name="nCode"></param>
        public void ClientHeroLogOut(byte nCode)
        {
            TFlowerEvent FlowerEvent;
            try
            {
                if (m_boWaitHeroDate || m_boHeroLogOut)
                {
                    return;
                }
                if (m_MyHero != null)
                {
                    if (m_MyHero.m_TargetCret != null) // 英雄攻击目标为英雄时,收回英雄,目标英雄则需要攻击主人
                    {
                        if ((m_MyHero.m_TargetCret.m_btRaceServer == Grobal2.RC_HEROOBJECT))
                        {
                            this.SetTargetCreat(m_MyHero.m_TargetCret);
                            m_MyHero.m_TargetCret.SetLastHiter(this);
                        }
                        else if ((m_MyHero.m_TargetCret.m_btRaceServer == Grobal2.RC_PLAYOBJECT) && (((m_MyHero.m_TargetCret) as TPlayObject).m_MyHero != null))
                        {
                            this.SetTargetCreat(m_MyHero.m_TargetCret);
                            ((m_MyHero.m_TargetCret) as TPlayObject).m_MyHero.SetLastHiter(this);
                        }
                    }
                    m_boHeroLogOut = true;// 英雄退出
                    ((THeroObject)(m_MyHero)).boCallLogOut = true;// 英雄正常退出
                    ((THeroObject)(m_MyHero)).m_boDeath = true;
                    if (((THeroObject)(m_MyHero)).m_btMentHero == 1)
                    {
                        m_nRecallHeroTime = HUtil32.GetTickCount();//召唤主将英雄间隔
                    }
                    else
                    {
                        m_nRecallDeputyHeroTime = HUtil32.GetTickCount(); // 召唤副将英雄间隔
                    }
                    FlowerEvent = new TFlowerEvent(m_MyHero.m_PEnvir, m_MyHero.m_nCurrX, m_MyHero.m_nCurrY, Grobal2.SM_HEROLOGOUT, 2500);// 英雄退出动画显示
                    FlowerEvent.m_dwRunTick = 1;// 加速效果显示
                    M2Share.g_EventManager.AddEvent(FlowerEvent);
                    UserEngine.SaveHeroRcd(this);// 保存英雄数据
                    this.SendDelayMsg(m_MyHero, Grobal2.RM_MAKEGHOSTHERO, 0, 0, 0, 0, "", 1000);// 修改为1000
                    this.SendUpdateMsg(m_MyHero, Grobal2.RM_DESTROYHERO, 0, m_MyHero.ToInt(), 0, 0, "");// 英雄销毁,左上角图标隐藏
                    if (nCode == 0)
                    {
                        // 神奇的力量散去，你的英雄开始沉睡。
                        this.SysMsg(GameMsgDef.g_sHeroClose, TMsgColor.c_Green, TMsgType.t_Hint);
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.ClientHeroLogOut");
            }
        }

        /// <summary>
        /// 客户端改变英雄状态
        /// </summary>
        public void ClientChgHeroStatus()
        {
            if (m_boWaitHeroDate)
            {
                return;
            }
            if (((THeroObject)(m_MyHero)) != null)
            {
                if (((THeroObject)(m_MyHero)).m_boProtectStatus)
                {
                    ((THeroObject)(m_MyHero)).m_boProtectStatus = false; // 守护时,一改变状态,则停止守护
                }
                if (((THeroObject)(m_MyHero)).m_btStatus >= 2)
                {
                    ((THeroObject)(m_MyHero)).m_btStatus = 0;
                }
                else
                {
                    ((THeroObject)(m_MyHero)).m_btStatus++;
                }
                switch (((THeroObject)(m_MyHero)).m_btStatus)
                {
                    case 1:
                        if (((THeroObject)(m_MyHero)).m_TargetCret != null)
                        {
                            ((THeroObject)(m_MyHero)).m_TargetCret = null;
                        }
                        ((THeroObject)(m_MyHero)).SysMsg(GameMsgDef.g_sHeroFollow, TMsgColor.C_HeroHint, TMsgType.t_Hint);
                        break;
                    case 0:
                        ((THeroObject)(m_MyHero)).SysMsg(GameMsgDef.g_sHeroAttack, TMsgColor.C_HeroHint, TMsgType.t_Hint);
                        break;
                    case 2:
                        if (((THeroObject)(m_MyHero)).m_TargetCret != null)
                        {
                            ((THeroObject)(m_MyHero)).m_TargetCret = null;
                        }
                        ((THeroObject)(m_MyHero)).SysMsg(GameMsgDef.g_sHeroRest, TMsgColor.C_HeroHint, TMsgType.t_Hint);
                        break;
                }
            }
        }

        /// <summary>
        /// 英雄守护
        /// </summary>
        /// <param name="nX"></param>
        /// <param name="nY"></param>
        public void ClientHeroProtect(int nX, int nY)
        {
            if (m_boWaitHeroDate)
            {
                return;
            }
            if ((GameConfig.boNoSafeProtect && this.InSafeZone()) || (this.m_PEnvir.m_boNOHEROPROTECT)) // 增加英雄安全区内不能守护,地图禁止守护
            {
                return;
            }
            if (((THeroObject)(m_MyHero)) != null)
            {
                ((THeroObject)(m_MyHero)).m_boProtectStatus = !((THeroObject)(m_MyHero)).m_boProtectStatus;
                if (((THeroObject)(m_MyHero)).m_boProtectStatus)
                {
                    ((THeroObject)(m_MyHero)).m_boProtectOK = false;
                    ((THeroObject)(m_MyHero)).m_nProtectTargetX = nX;
                    ((THeroObject)(m_MyHero)).m_nProtectTargetY = nY;
                    ((THeroObject)(m_MyHero)).SysMsg(string.Format(GameMsgDef.g_sHeroProtect, nX, nY), TMsgColor.BB_Fuchsia, TMsgType.t_Hint);// '英雄:开始守护(%d/%d)'
                }
                else
                {
                    ((THeroObject)(m_MyHero)).m_boProtectOK = false;
                    ((THeroObject)(m_MyHero)).m_nProtectTargetX = -1;
                    ((THeroObject)(m_MyHero)).m_nProtectTargetY = -1;
                    ((THeroObject)(m_MyHero)).SysMsg(string.Format(GameMsgDef.g_sHeroNotProtect, nX, nY), TMsgColor.BB_Fuchsia, TMsgType.t_Hint); // '英雄:停止守护(%d/%d)'
                }
            }
        }

        /// <summary>
        /// 锁定攻击目标
        /// </summary>
        /// <param name="BaseObject"></param>
        /// <param name="nX"></param>
        /// <param name="nY"></param>
        public void ClientHeroAttack(TBaseObject BaseObject, int nX, int nY)
        {
            if (HUtil32.GetTickCount() - m_TargetTime > 1500) // 锁定目标间隔
            {
                if (m_boWaitHeroDate)
                {
                    return;
                }
                if (((THeroObject)(m_MyHero)) != null)
                {
                    if (this.CretInNearXY(BaseObject, nX, nY) && (!((THeroObject)(m_MyHero)).m_boDeath))
                    {
                        if ((BaseObject != this) && (BaseObject != m_MyHero) && (!BaseObject.m_boDeath)) // 加入,怪死后不能再锁定
                        {
                            if ((BaseObject.m_btRaceServer < Grobal2.RC_NPC) || (BaseObject.m_btRaceServer > Grobal2.RC_PEACENPC))
                            {
                                if ((BaseObject.m_btRaceServer != 110) && (BaseObject.m_btRaceServer != 111))
                                {
                                    if (this.IsProperTarget(BaseObject))
                                    {
                                        m_TargetTime = HUtil32.GetTickCount();// 锁定目标间隔
                                        if (((THeroObject)(m_MyHero)).m_boProtectStatus)  // 自动切换英雄状态
                                        {
                                            ((THeroObject)(m_MyHero)).m_boProtectStatus = false;  // 守护时,锁定则停止守护
                                        }
                                        if ((!this.m_PEnvir.m_boMISSION) && (((THeroObject)(m_MyHero)).m_btStatus != 0))
                                        {
                                            ((THeroObject)(m_MyHero)).m_btStatus = 0;// (英雄)状态：攻击
                                            ((THeroObject)(m_MyHero)).SysMsg(GameMsgDef.g_sHeroAttack, TMsgColor.C_HeroHint, TMsgType.t_Hint);
                                        }
                                        if (GameConfig.boUnKnowHum && BaseObject.IsUsesZhuLi())
                                        {
                                            this.SysMsg(string.Format("攻击目标:{0}", "神秘人"), TMsgColor.c_Red, TMsgType.t_Hint);  //带上斗笠,不显示人的真正名字
                                        }
                                        else
                                        {
                                            if ((BaseObject.m_btRaceServer == Grobal2.RC_PLAYOBJECT))
                                            {
                                                this.SysMsg(string.Format("攻击目标: {0}", BaseObject.m_sCharName), TMsgColor.c_Red, TMsgType.t_Hint);
                                            }
                                            else if ((BaseObject.m_btRaceServer == Grobal2.RC_HEROOBJECT) && (BaseObject.m_Master != null))
                                            {
                                                this.SysMsg(string.Format("攻击目标: {0} 的英雄:{1}", BaseObject.m_Master.m_sCharName, BaseObject.m_sCharName), TMsgColor.c_Red, TMsgType.t_Hint);
                                            }
                                            else
                                            {
                                                this.SysMsg(string.Format("攻击目标: {0}", M2Share.FilterShowName(BaseObject.m_sCharName)), TMsgColor.c_Red, TMsgType.t_Hint);
                                            }
                                        }
                                        ((THeroObject)(m_MyHero)).m_boTarget = true;
                                        ((THeroObject)(m_MyHero)).SetTargetXY(BaseObject.m_nCurrX, BaseObject.m_nCurrY);
                                        ((THeroObject)(m_MyHero)).SetTargetCreat(BaseObject);
                                        this.SetTargetCreat(BaseObject);
                                        if (BaseObject.IsProperTarget(m_MyHero))
                                        {
                                            BaseObject.SetTargetCreat(m_MyHero);  // 对方也把英雄当成目标
                                        }
                                        if ((((THeroObject)(m_MyHero)).m_btJob == 0))
                                        {
                                            if ((Math.Abs(m_MyHero.m_nCurrX - ((THeroObject)(m_MyHero)).m_nTargetX) > 1) || (Math.Abs(m_MyHero.m_nCurrY - ((THeroObject)(m_MyHero)).m_nTargetY) > 1))
                                            {
                                                ((THeroObject)(m_MyHero)).RunToTargetXY(BaseObject.m_nCurrX, BaseObject.m_nCurrY);// 走向锁定的目标
                                            }
                                        }
                                        else
                                        {
                                            if ((Math.Abs(m_MyHero.m_nCurrX - ((THeroObject)(m_MyHero)).m_nTargetX) > 3) || (Math.Abs(m_MyHero.m_nCurrY - ((THeroObject)(m_MyHero)).m_nTargetY) > 3))
                                            {
                                                ((THeroObject)(m_MyHero)).GetGotoXY(((THeroObject)(m_MyHero)).m_TargetCret, 3);// 道法只走向目标3格范围
                                                ((THeroObject)(m_MyHero)).RunToTargetXY(((THeroObject)(m_MyHero)).m_nTargetX, ((THeroObject)(m_MyHero)).m_nTargetY);
                                            }
                                        }
                                        if ((BaseObject.m_btRaceServer == Grobal2.RC_PLAYOBJECT) || (BaseObject.m_btRaceServer == Grobal2.RC_HEROOBJECT))
                                        {
                                            BaseObject.SetPKFlag(this);// 设置主人灰名  
                                            BaseObject.SetPKFlag(m_MyHero);// 设置英雄灰名
                                        }
                                        if (((THeroObject)(m_MyHero)).m_boDecDragonPoint)
                                        {
                                            ClientHeroUseSpell(); // 减怒气时,直接放合击
                                        }
                                        return;
                                    }
                                }
                            }
                        }
                    }
                    ((THeroObject)(m_MyHero)).m_TargetCret = null;
                    ((THeroObject)(m_MyHero)).m_boTarget = false;
                }
            }
        }

        /// <summary>
        /// 开始合击(去掉英雄守护不能合击)
        /// </summary>
        private unsafe void ClientHeroUseSpell()
        {
            TUserMagic* TogetherMagic;
            int nSpellPoint;
            try
            {
                if (m_boWaitHeroDate)
                {
                    return;
                }
                if ((!m_MyHero.m_boDeath) && (!m_MyHero.m_boGhost) && (!this.m_boDeath) && (!this.m_boGhost))
                {
                    if ((((THeroObject)(m_MyHero)).m_btStatus != 2) && (m_MyHero.m_PEnvir == this.m_PEnvir) && (Math.Abs(m_MyHero.m_nCurrX - this.m_nCurrX) <= 13)
                        && (Math.Abs(m_MyHero.m_nCurrY - this.m_nCurrY) <= 13) && (((THeroObject)(m_MyHero)).WearFirDragon()))// 戴火龙之心才能放合击
                    {
                        if (((THeroObject)(m_MyHero)).m_boTarget) // 锁定目标
                        {
                            if ((m_MyHero.m_TargetCret != null) && (Math.Abs(m_MyHero.m_TargetCret.m_nCurrX - this.m_nCurrX) <= 13) && (Math.Abs(m_MyHero.m_TargetCret.m_nCurrY - this.m_nCurrY) <= 13))
                            {
                                if ((((THeroObject)(m_MyHero)).m_nFirDragonPoint >= GameConfig.nMaxFirDragonPoint) || (((THeroObject)(m_MyHero)).m_boDecDragonPoint))// 气槽满
                                {
                                    TogetherMagic = ((THeroObject)(m_MyHero)).FindTogetherMagic();
                                    if (TogetherMagic != null)
                                    {
                                        nSpellPoint = GetSpellPoint(TogetherMagic);
                                        if ((nSpellPoint <= this.m_WAbil.MP) && (nSpellPoint <= m_MyHero.m_WAbil.MP))
                                        {
                                            switch (TogetherMagic->wMagIdx)
                                            {
                                                case 60:// 破魂斩
                                                    if ((m_MyHero.m_TargetCret != null))
                                                    {
                                                        this.SetTargetCreat(m_MyHero.m_TargetCret);
                                                    }
                                                    if (((this.m_wStatusTimeArr[Grobal2.POISON_STONE] != 0) || (((THeroObject)(m_MyHero)).m_wStatusTimeArr[Grobal2.POISON_STONE] != 0)) && (!GameConfig.ClientConf.boParalyCanSpell))
                                                    {
                                                        // 麻痹不能合击
                                                        ((THeroObject)(m_MyHero)).m_boDecDragonPoint = true;// 开始减怒气
                                                        return;
                                                    }
                                                    // 直线才放破魂斩
                                                    if (!((((Math.Abs(this.m_TargetCret.m_nCurrX - m_MyHero.m_nCurrX) == 2) && (Math.Abs(this.m_TargetCret.m_nCurrY - m_MyHero.m_nCurrY) == 0)) || ((Math.Abs(this.m_TargetCret.m_nCurrX - m_MyHero.m_nCurrX) == 1) && (Math.Abs(this.m_TargetCret.m_nCurrY - m_MyHero.m_nCurrY) == 0)) || ((Math.Abs(this.m_TargetCret.m_nCurrX - m_MyHero.m_nCurrX) == 1) && (Math.Abs(this.m_TargetCret.m_nCurrY - m_MyHero.m_nCurrY) == 1)) || ((Math.Abs(this.m_TargetCret.m_nCurrX - m_MyHero.m_nCurrX) == 2) && (Math.Abs(this.m_TargetCret.m_nCurrY - m_MyHero.m_nCurrY) == 2)) || ((Math.Abs(this.m_TargetCret.m_nCurrX - m_MyHero.m_nCurrX) == 0) && (Math.Abs(this.m_TargetCret.m_nCurrY - m_MyHero.m_nCurrY) == 1)) || ((Math.Abs(this.m_TargetCret.m_nCurrX - m_MyHero.m_nCurrX) == 0) && (Math.Abs(this.m_TargetCret.m_nCurrY - m_MyHero.m_nCurrY) == 2)))))
                                                    {
                                                        ((THeroObject)(m_MyHero)).m_boDecDragonPoint = true;// 开始减怒气
                                                        ((THeroObject)(m_MyHero)).GotoTargetXY(m_MyHero.m_TargetCret.m_nCurrX, m_MyHero.m_TargetCret.m_nCurrY, 1);// 英雄走向目标
                                                        return;
                                                    }
                                                    else if (!((((Math.Abs(this.m_TargetCret.m_nCurrX - this.m_nCurrX) == 2) && (Math.Abs(this.m_TargetCret.m_nCurrY - this.m_nCurrY) == 0)) || ((Math.Abs(this.m_TargetCret.m_nCurrX - this.m_nCurrX) == 1) && (Math.Abs(this.m_TargetCret.m_nCurrY - this.m_nCurrY) == 0)) || ((Math.Abs(this.m_TargetCret.m_nCurrX - this.m_nCurrX) == 1) && (Math.Abs(this.m_TargetCret.m_nCurrY - this.m_nCurrY) == 1)) || ((Math.Abs(this.m_TargetCret.m_nCurrX - this.m_nCurrX) == 2) && (Math.Abs(this.m_TargetCret.m_nCurrY - this.m_nCurrY) == 2)) || ((Math.Abs(this.m_TargetCret.m_nCurrX - this.m_nCurrX) == 0) && (Math.Abs(this.m_TargetCret.m_nCurrY - this.m_nCurrY) == 1)) || ((Math.Abs(this.m_TargetCret.m_nCurrX - this.m_nCurrX) == 0) && (Math.Abs(this.m_TargetCret.m_nCurrY - this.m_nCurrY) == 2)))))
                                                    {
                                                        ((THeroObject)(m_MyHero)).m_boDecDragonPoint = true;// 开始减怒气
                                                        return;
                                                    }
                                                    break;
                                                case 61:
                                                case 62:// 劈星斩,雷霆一击(近攻合击,战要近目标) 
                                                    if ((m_MyHero.m_TargetCret != null))  //英雄锁定后，主人被其它目标打时，合击会打不是锁定的目标
                                                    {
                                                        this.SetTargetCreat(m_MyHero.m_TargetCret);
                                                    }
                                                    if (((this.m_wStatusTimeArr[Grobal2.POISON_STONE] != 0) || (((THeroObject)(m_MyHero)).m_wStatusTimeArr[Grobal2.POISON_STONE] != 0)) && (!GameConfig.ClientConf.boParalyCanSpell))
                                                    {
                                                        // 麻痹不能合击
                                                        ((THeroObject)(m_MyHero)).m_boDecDragonPoint = true;// 开始减怒气
                                                        return;
                                                    }
                                                    if ((this.m_btJob == 0) && ((Math.Abs(m_MyHero.m_TargetCret.m_nCurrX - this.m_nCurrX) > 2) || (Math.Abs(m_MyHero.m_TargetCret.m_nCurrY - this.m_nCurrY) > 2)))
                                                    {
                                                        ((THeroObject)(m_MyHero)).m_boDecDragonPoint = true;// 开始减怒气
                                                        return;
                                                    }
                                                    else if ((((THeroObject)(m_MyHero)).m_btJob == 0) && ((Math.Abs(m_MyHero.m_TargetCret.m_nCurrX - m_MyHero.m_nCurrX) > 2) || (Math.Abs(m_MyHero.m_TargetCret.m_nCurrY - m_MyHero.m_nCurrY) > 2)))
                                                    {
                                                        ((THeroObject)(m_MyHero)).m_boDecDragonPoint = true;// 开始减怒气
                                                        ((THeroObject)(m_MyHero)).GotoTargetXY(m_MyHero.m_TargetCret.m_nCurrX, m_MyHero.m_TargetCret.m_nCurrY, 1);// 英雄走向目标
                                                        return;
                                                    }
                                                    break;
                                                case 63:
                                                case 64:
                                                case 65:
                                                    if (((this.m_wStatusTimeArr[Grobal2.POISON_STONE] != 0) || (((THeroObject)(m_MyHero)).m_wStatusTimeArr[Grobal2.POISON_STONE] != 0)) && (!GameConfig.ClientConf.boParalyCanSpell))
                                                    {
                                                        //麻痹不能合击
                                                        ((THeroObject)(m_MyHero)).m_boDecDragonPoint = true;// 开始减怒气
                                                        return;
                                                    }
                                                    break;
                                            }
                                            ((THeroObject)(m_MyHero)).m_boStartUseSpell = true;
                                            ((THeroObject)(m_MyHero)).m_boDecDragonPoint = false;// 停止减怒气
                                            ((THeroObject)(m_MyHero)).m_nFirDragonPoint = 0;// 清空怒气值
                                            ((THeroObject)(m_MyHero)).m_dwStartUseSpellTick = HUtil32.GetTickCount();
                                            ((THeroObject)(m_MyHero)).m_dwHitTick = HUtil32.GetTickCount();//直接进入魔法过程,以加速合击速度
                                            if (((THeroObject)(m_MyHero)).ClientSpellXY(TogetherMagic, m_MyHero.m_TargetCret.m_nCurrX, m_MyHero.m_TargetCret.m_nCurrY, m_MyHero.m_TargetCret))
                                            {
                                                ((THeroObject)(m_MyHero)).m_boStartUseSpell = false;
                                            }
                                        }
                                        else
                                        {
                                            // MP不足时提示
                                            if (nSpellPoint > this.m_WAbil.MP)
                                            {
                                                this.SysMsg("MP不足,不能使用合击技能！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                                            }
                                            if (nSpellPoint > m_MyHero.m_WAbil.MP)
                                            {
                                                this.SysMsg("(英雄) MP不足,不能使用合击技能！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (this.m_TargetCret != null) // 没有锁定目标,则攻击当前目标,
                            {
                                m_MyHero.m_TargetCret = this.m_TargetCret;// 释放合击时,如果英雄目标为空,则默认攻击主人的目标
                            }
                            else if ((m_MyHero.m_TargetCret != null))
                            {
                                this.SetTargetCreat(m_MyHero.m_TargetCret);
                            }
                            if ((m_MyHero.m_TargetCret != null) && (Math.Abs(m_MyHero.m_TargetCret.m_nCurrX - this.m_nCurrX) <= 13) && (Math.Abs(m_MyHero.m_TargetCret.m_nCurrY - this.m_nCurrY) <= 13))
                            {
                                if ((((THeroObject)(m_MyHero)).m_nFirDragonPoint >= GameConfig.nMaxFirDragonPoint) || (((THeroObject)(m_MyHero)).m_boDecDragonPoint))
                                {
                                    TogetherMagic = ((THeroObject)(m_MyHero)).FindTogetherMagic();
                                    if (TogetherMagic != null)
                                    {
                                        nSpellPoint = GetSpellPoint(TogetherMagic);
                                        if ((nSpellPoint <= this.m_WAbil.MP) && (nSpellPoint <= m_MyHero.m_WAbil.MP))
                                        {
                                            switch (TogetherMagic->wMagIdx)
                                            {
                                                case 60:// 破魂斩
                                                    if (this.m_TargetCret != null)
                                                    {
                                                        m_MyHero.SetTargetCreat(this.m_TargetCret);
                                                    }
                                                    else if ((m_MyHero.m_TargetCret != null))
                                                    {
                                                        this.SetTargetCreat(m_MyHero.m_TargetCret);
                                                    }
                                                    if (((this.m_wStatusTimeArr[Grobal2.POISON_STONE] != 0) ||
                                                        (((THeroObject)(m_MyHero)).m_wStatusTimeArr[Grobal2.POISON_STONE] != 0)) &&
                                                        (!GameConfig.ClientConf.boParalyCanSpell))//  麻痹不能合击
                                                    {
                                                        ((THeroObject)(m_MyHero)).m_boDecDragonPoint = true;// 开始减怒气
                                                        return;
                                                    }
                                                    //修改，直线才放破魂斩
                                                    if (!((((Math.Abs(this.m_TargetCret.m_nCurrX - m_MyHero.m_nCurrX) == 2) && (Math.Abs(this.m_TargetCret.m_nCurrY - m_MyHero.m_nCurrY) == 0)) || ((Math.Abs(this.m_TargetCret.m_nCurrX - m_MyHero.m_nCurrX) == 1) && (Math.Abs(this.m_TargetCret.m_nCurrY - m_MyHero.m_nCurrY) == 0)) || ((Math.Abs(this.m_TargetCret.m_nCurrX - m_MyHero.m_nCurrX) == 1) && (Math.Abs(this.m_TargetCret.m_nCurrY - m_MyHero.m_nCurrY) == 1)) || ((Math.Abs(this.m_TargetCret.m_nCurrX - m_MyHero.m_nCurrX) == 2) && (Math.Abs(this.m_TargetCret.m_nCurrY - m_MyHero.m_nCurrY) == 2)) || ((Math.Abs(this.m_TargetCret.m_nCurrX - m_MyHero.m_nCurrX) == 0) && (Math.Abs(this.m_TargetCret.m_nCurrY - m_MyHero.m_nCurrY) == 1)) || ((Math.Abs(this.m_TargetCret.m_nCurrX - m_MyHero.m_nCurrX) == 0) && (Math.Abs(this.m_TargetCret.m_nCurrY - m_MyHero.m_nCurrY) == 2)))))
                                                    {
                                                        ((THeroObject)(m_MyHero)).m_boDecDragonPoint = true; // 开始减怒气
                                                        ((THeroObject)(m_MyHero)).GotoTargetXY(m_MyHero.m_TargetCret.m_nCurrX, m_MyHero.m_TargetCret.m_nCurrY, 1);// 英雄走向目标
                                                        return;
                                                    }
                                                    else if (!((((Math.Abs(this.m_TargetCret.m_nCurrX - this.m_nCurrX) == 2) && (Math.Abs(this.m_TargetCret.m_nCurrY - this.m_nCurrY) == 0))
                                                        || ((Math.Abs(this.m_TargetCret.m_nCurrX - this.m_nCurrX) == 1) && (Math.Abs(this.m_TargetCret.m_nCurrY - this.m_nCurrY) == 0))
                                                        || ((Math.Abs(this.m_TargetCret.m_nCurrX - this.m_nCurrX) == 1) && (Math.Abs(this.m_TargetCret.m_nCurrY - this.m_nCurrY) == 1))
                                                        || ((Math.Abs(this.m_TargetCret.m_nCurrX - this.m_nCurrX) == 2) && (Math.Abs(this.m_TargetCret.m_nCurrY - this.m_nCurrY) == 2))
                                                        || ((Math.Abs(this.m_TargetCret.m_nCurrX - this.m_nCurrX) == 0) && (Math.Abs(this.m_TargetCret.m_nCurrY - this.m_nCurrY) == 1))
                                                        || ((Math.Abs(this.m_TargetCret.m_nCurrX - this.m_nCurrX) == 0) && (Math.Abs(this.m_TargetCret.m_nCurrY - this.m_nCurrY) == 2)))))
                                                    {
                                                        ((THeroObject)(m_MyHero)).m_boDecDragonPoint = true;// 开始减怒气
                                                        return;
                                                    }
                                                    break;
                                                case 61:
                                                case 62:// 劈星斩,雷霆一击(近攻合击,战要近目标)
                                                    if (this.m_TargetCret != null)
                                                    {
                                                        m_MyHero.SetTargetCreat(this.m_TargetCret);
                                                    }
                                                    else if ((m_MyHero.m_TargetCret != null))
                                                    {
                                                        this.SetTargetCreat(m_MyHero.m_TargetCret);
                                                    }
                                                    if (((this.m_wStatusTimeArr[Grobal2.POISON_STONE] != 0) ||
                                                        (((THeroObject)(m_MyHero)).m_wStatusTimeArr[Grobal2.POISON_STONE] != 0)) &&
                                                        (!GameConfig.ClientConf.boParalyCanSpell)) // 麻痹不能合击
                                                    {
                                                        ((THeroObject)(m_MyHero)).m_boDecDragonPoint = true; // 开始减怒气
                                                        return;
                                                    }
                                                    if ((this.m_btJob == 0) && ((Math.Abs(this.m_TargetCret.m_nCurrX - this.m_nCurrX) > 1) || (Math.Abs(this.m_TargetCret.m_nCurrY - this.m_nCurrY) > 1)))
                                                    {
                                                        ((THeroObject)(m_MyHero)).m_boDecDragonPoint = true;//开始减怒气

                                                        return;
                                                    }
                                                    else if ((((THeroObject)(m_MyHero)).m_btJob == 0) && ((Math.Abs(this.m_TargetCret.m_nCurrX - m_MyHero.m_nCurrX) > 2) || (Math.Abs(this.m_TargetCret.m_nCurrY - m_MyHero.m_nCurrY) > 2)))
                                                    {
                                                        ((THeroObject)(m_MyHero)).m_boDecDragonPoint = true;// 开始减怒气
                                                        ((THeroObject)(m_MyHero)).GotoTargetXY(m_MyHero.m_TargetCret.m_nCurrX, m_MyHero.m_TargetCret.m_nCurrY, 1); // 英雄走向目标
                                                        return;
                                                    }
                                                    break;
                                                case 63:
                                                case 64:
                                                case 65:
                                                    if (((this.m_wStatusTimeArr[Grobal2.POISON_STONE] != 0) ||
                                                        (((THeroObject)(m_MyHero)).m_wStatusTimeArr[Grobal2.POISON_STONE] != 0)) &&
                                                        (!GameConfig.ClientConf.boParalyCanSpell)) // 麻痹不能合击
                                                    {
                                                        ((THeroObject)(m_MyHero)).m_boDecDragonPoint = true; // 开始减怒气
                                                        return;
                                                    }
                                                    break;
                                            }
                                            ((THeroObject)(m_MyHero)).m_boStartUseSpell = true;
                                            ((THeroObject)(m_MyHero)).m_boDecDragonPoint = false;//停止减怒气
                                            ((THeroObject)(m_MyHero)).m_nFirDragonPoint = 0; // 清空怒气值
                                            ((THeroObject)(m_MyHero)).m_dwStartUseSpellTick = HUtil32.GetTickCount();
                                            ((THeroObject)(m_MyHero)).m_dwHitTick = HUtil32.GetTickCount();// 直接进入魔法过程,以加速合击速度
                                            if (((THeroObject)(m_MyHero)).ClientSpellXY(TogetherMagic, m_MyHero.m_TargetCret.m_nCurrX, m_MyHero.m_TargetCret.m_nCurrY, m_MyHero.m_TargetCret))
                                            {
                                                ((THeroObject)(m_MyHero)).m_boStartUseSpell = false;
                                            }
                                        }
                                        else
                                        {
                                            if (nSpellPoint > this.m_WAbil.MP)  // MP不足时提示
                                            {
                                                this.SysMsg("MP值不足,不能使用合击技能！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                                            }
                                            if (nSpellPoint > m_MyHero.m_WAbil.MP)
                                            {
                                                this.SysMsg("(英雄) MP值不足,不能使用合击技能！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                                            }
                                        }
                                    }
                                }
                            }
                            else if ((((THeroObject)(m_MyHero)).m_nFirDragonPoint >= GameConfig.nMaxFirDragonPoint)) // 怒气值满时,才可以减怒气
                            {
                                ((THeroObject)(m_MyHero)).m_boDecDragonPoint = true; // 没有目标也,开始减怒气
                            }

                        }
                    }
                }
            }
            catch
            {
            }
        }

        /// <summary>
        /// 从装备栏取装备放到包裹里
        /// </summary>
        /// <param name="nIndex"></param>
        /// <param name="btWhere"></param>
        /// <param name="nItemIdx"></param>
        /// <param name="sItemName"></param>
        public unsafe void ClientTakeOnItemsFormBag(int nIndex, byte btWhere, int nItemIdx, string sItemName)
        {
            int n14;
            int n18;
            TUserItem* UserItem = null;
            TUserItem* TakeOffItem;
            TStdItem* StdItem;
            TStdItem* StdItem20;
            TStdItem* StdItem58;
            string sUserItemName;
            StdItem = null;
            n14 = -1;
            n18 = -1;
            if ((m_MyHero == null) || m_boWaitHeroDate)
            {
                goto FailExit;
            }
            switch (nIndex)
            {
                case Grobal2.CM_HEROTAKEONITEMFORMMASTERBAG:
                    if (this.m_ItemList.Count > 0)
                    {
                        for (int I = 0; I < this.m_ItemList.Count; I++)
                        {
                            UserItem = (TUserItem*)this.m_ItemList[I];
                            if ((UserItem != null) && (UserItem->MakeIndex == nItemIdx))
                            {
                                sUserItemName = "";// 取自定义物品名称
                                if (UserItem->btValue[13] == 1)
                                {
                                    sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                                }
                                if (sUserItemName == "")
                                {
                                    sUserItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                                }
                                StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                                if (UserItem->btValue[12] == 1)// 物品发光
                                {
                                    StdItem->Reserved1 = 1;
                                }
                                else
                                {
                                    StdItem->Reserved1 = 0;
                                }
                                if (StdItem != null)
                                {
                                    if (string.Compare(sUserItemName, sItemName, true) == 0)
                                    {
                                        n14 = I;
                                        break;
                                    }
                                }
                            }
                            UserItem = null;
                        }
                        n18 = 0;
                        if ((StdItem != null) && (UserItem != null))
                        {
                            if (M2Share.CheckUserItems(btWhere, StdItem))
                            {
                                StdItem58 = StdItem;
                                ItemUnit.GetItemAddValue(UserItem, StdItem58);
                                if (((THeroObject)(m_MyHero)).CheckTakeOnItems(btWhere, StdItem58))
                                {
                                    TakeOffItem = null;
                                    if (btWhere >= 0 && btWhere <= 13)  // 支持斗笠,0..12改0..13
                                    {
                                        if (((THeroObject)(m_MyHero)).m_UseItems[btWhere]->wIndex > 0)
                                        {
                                            StdItem20 = UserEngine.GetStdItem(((THeroObject)(m_MyHero)).m_UseItems[btWhere]->wIndex);
                                            if ((StdItem20 != null) && (new ArrayList(new int[] { 15, 19, 20, 21, 22, 23, 24, 26 }).Contains(StdItem20->StdMode)))
                                            {
                                                if ((!this.m_boUserUnLockDurg) && (((THeroObject)(m_MyHero)).m_UseItems[btWhere]->btValue[7] != 0))
                                                {
                                                    // '无法取下物品！！！'
                                                    ((THeroObject)(m_MyHero)).SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);
                                                    n18 = -4;
                                                    goto FailExit;
                                                }
                                            }
                                            // 因为虎啸装备 是吸血成功的几率所以所不能使用 StdItem->Reserved 判断
                                            // Shape=193 Need-(30)需等级，Stock-为吸血点 NeedLevel-所需等级 Reserved-成功机率
                                            // Shape=193 Need-(31)需攻击，Stock-为吸血点 NeedLevel-所需攻击 Reserved-成功机率
                                            // Shape=193 Need-(32)需魔法，Stock-为吸血点 NeedLevel-所需魔法 Reserved-成功机率
                                            // Shape=193 Need-(33)需道术，Stock-为吸血点 NeedLevel-所需道术 Reserved-成功机率
                                            if (!(StdItem->Shape == 193))
                                            {
                                                if (!this.m_boUserUnLockDurg && ((StdItem20->Reserved & 2) != 0))
                                                {
                                                    // '无法取下物品！！！'
                                                    ((THeroObject)(m_MyHero)).SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);
                                                    n18 = -4;
                                                    goto FailExit;
                                                }
                                                if ((StdItem20->Reserved & 4) != 0)
                                                {
                                                    // '无法取下物品！！！'
                                                    ((THeroObject)(m_MyHero)).SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);
                                                    n18 = -4;
                                                    goto FailExit;
                                                }
                                            }
                                            if (M2Share.InDisableTakeOffList(((THeroObject)(m_MyHero)).m_UseItems[btWhere]->wIndex))
                                            {
                                                // '无法取下物品！！！'
                                                ((THeroObject)(m_MyHero)).SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);
                                                goto FailExit;
                                            }
                                            TakeOffItem = ((THeroObject)(m_MyHero)).m_UseItems[btWhere];
                                        }
                                        if ((new ArrayList(new int[] { 15, 19, 20, 21, 22, 23, 24, 26 }).Contains(StdItem->StdMode)) && (UserItem->btValue[8] != 0))
                                        {
                                            UserItem->btValue[8] = 0;
                                        }
                                        ((THeroObject)(m_MyHero)).m_UseItems[btWhere] = UserItem;
                                        this.DelBagItem(n14);
                                        if (TakeOffItem != null)
                                        {
                                            if (this.AddItemToBag(TakeOffItem))
                                            {
                                                SendAddItem(TakeOffItem);
                                            }
                                        }
                                        ((THeroObject)(m_MyHero)).RecalcAbilitys();
                                        m_MyHero.CompareSuitItem(false);//套装
                                        ((THeroObject)(m_MyHero)).SendMsg(m_MyHero, Grobal2.RM_HEROABILITY, 0, 0, 0, 0, "");
                                        ((THeroObject)(m_MyHero)).SendMsg(m_MyHero, Grobal2.RM_HEROSUBABILITY, 0, 0, 0, 0, "");
                                        ((THeroObject)(m_MyHero)).WeightChanged();
                                        ((THeroObject)(m_MyHero)).SendDefMessage(Grobal2.SM_HEROTAKEON_OK, ((THeroObject)(m_MyHero)).GetFeatureToLong(), m_MyHero.GetFeatureEx(), 0, 0, "");
                                        ((THeroObject)(m_MyHero)).FeatureChanged();
                                        n18 = 1;
                                    }
                                }
                                else
                                {
                                    n18 = -1;
                                }
                            }
                            else
                            {
                                n18 = -1;
                            }
                        }
                    }
                    break;
                case Grobal2.CM_TAKEONITEMFORMHEROBAG:
                    if (((THeroObject)(m_MyHero)).m_ItemList.Count > 0)
                    {
                        for (int I = 0; I < ((THeroObject)(m_MyHero)).m_ItemList.Count; I++)
                        {
                            UserItem = (TUserItem*)((THeroObject)(m_MyHero)).m_ItemList[I];
                            if ((UserItem != null) && (UserItem->MakeIndex == nItemIdx))
                            {
                                sUserItemName = "";// 取自定义物品名称
                                if (UserItem->btValue[13] == 1)
                                {
                                    sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                                }
                                if (sUserItemName == "")
                                {
                                    sUserItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                                }
                                StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                                if (UserItem->btValue[12] == 1)  // 物品发光
                                {
                                    StdItem->Reserved1 = 1;
                                }
                                else
                                {
                                    StdItem->Reserved1 = 0;
                                }
                                if (StdItem != null)
                                {
                                    if (string.Compare(sUserItemName, sItemName, true) == 0)
                                    {
                                        n14 = I;
                                        break;
                                    }
                                }
                            }
                            UserItem = null;
                        }
                        n18 = 0;
                        if ((StdItem != null) && (UserItem != null))
                        {
                            if (M2Share.CheckUserItems(btWhere, StdItem))
                            {
                                StdItem58 = StdItem;
                                ItemUnit.GetItemAddValue(UserItem, StdItem58);
                                if (CheckTakeOnItems(btWhere, StdItem58))
                                {
                                    TakeOffItem = null;
                                    if (btWhere >= 0 && btWhere <= 13)// 支持斗笠,0..12改0..13
                                    {
                                        if (this.m_UseItems[btWhere]->wIndex > 0)
                                        {
                                            StdItem20 = UserEngine.GetStdItem(this.m_UseItems[btWhere]->wIndex);
                                            if ((StdItem20 != null) && (new ArrayList(new int[] { 15, 19, 20, 21, 22, 23, 24, 26 }).Contains(StdItem20->StdMode)))
                                            {
                                                if ((!this.m_boUserUnLockDurg) && (((THeroObject)(m_MyHero)).m_UseItems[btWhere]->btValue[7] != 0))
                                                {
                                                    // '无法取下物品！！！'
                                                    this.SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);
                                                    n18 = -4;
                                                    goto FailExit;
                                                }
                                            }
                                            if (!this.m_boUserUnLockDurg && ((StdItem20->Reserved & 2) != 0))
                                            {
                                                // '无法取下物品！！！'
                                                this.SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);
                                                n18 = -4;
                                                goto FailExit;
                                            }
                                            if ((StdItem20->Reserved & 4) != 0)
                                            {
                                                // '无法取下物品！！！'
                                                this.SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);
                                                n18 = -4;
                                                goto FailExit;
                                            }
                                            if (M2Share.InDisableTakeOffList(((THeroObject)(m_MyHero)).m_UseItems[btWhere]->wIndex))
                                            {
                                                // '无法取下物品！！！'
                                                this.SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);
                                                goto FailExit;
                                            }
                                            TakeOffItem = this.m_UseItems[btWhere];
                                        }
                                        if ((new ArrayList(new int[] { 15, 19, 20, 21, 22, 23, 24, 26 }).Contains(StdItem->StdMode)) && (UserItem->btValue[8] != 0))
                                        {
                                            UserItem->btValue[8] = 0;
                                        }
                                        this.m_UseItems[btWhere] = UserItem;
                                        ((THeroObject)(m_MyHero)).DelBagItem(n14);
                                        if (TakeOffItem != null)
                                        {
                                            if (((THeroObject)(m_MyHero)).AddItemToBag(TakeOffItem))
                                            {
                                                ((THeroObject)(m_MyHero)).SendAddItem(TakeOffItem);
                                            }
                                        }
                                        RecalcAbilitys();
                                        this.CompareSuitItem(false);//套装
                                        this.SendMsg(this, Grobal2.RM_ABILITY, 0, 0, 0, 0, "");
                                        this.SendMsg(this, Grobal2.RM_SUBABILITY, 0, 0, 0, 0, "");
                                        SendDefMessage(Grobal2.SM_TAKEON_OK, this.GetFeatureToLong(), this.GetFeatureEx(), 0, 0, "");
                                        this.FeatureChanged();
                                        n18 = 1;
                                    }
                                }
                                else
                                {
                                    n18 = -1;
                                }
                            }
                            else
                            {
                                n18 = -1;
                            }
                        }
                    }
                    break;
            }
        FailExit:
            switch (nIndex)
            {
                case Grobal2.CM_HEROTAKEONITEMFORMMASTERBAG:
                    if (n18 <= 0)
                    {
                        SendDefMessage(Grobal2.SM_TAKEON_FAIL, n18, 0, 0, 0, "");
                    }
                    break;
                case Grobal2.CM_TAKEONITEMFORMHEROBAG:
                    if (n18 <= 0)
                    {
                        SendDefMessage(Grobal2.SM_HEROTAKEON_FAIL, n18, 0, 0, 0, "");
                    }
                    break;
            }
        }

        /// <summary>
        /// 英雄穿上装备
        /// </summary>
        /// <param name="btWhere"></param>
        /// <param name="nItemIdx"></param>
        /// <param name="sItemName"></param>
        public unsafe void ClientHeroTakeOnItems(byte btWhere, int nItemIdx, string sItemName)
        {
            int n14;
            int n18;
            TUserItem* UserItem = null;
            TUserItem* TakeOffItem;
            TStdItem* StdItem;
            TStdItem* StdItem20;
            TStdItem* StdItem58;
            string sUserItemName = string.Empty;
            TBaseObject Slave;
            StdItem = null;
            n14 = -1;
            n18 = -1;
            if ((m_MyHero == null) || m_boWaitHeroDate)
            {
                goto FailExit;
            }
            if (((THeroObject)(m_MyHero)).m_ItemList.Count > 0)
            {
                for (int I = 0; I < ((THeroObject)(m_MyHero)).m_ItemList.Count; I++)
                {
                    UserItem = (TUserItem*)((THeroObject)(m_MyHero)).m_ItemList[I];
                    if ((UserItem != null) && (UserItem->MakeIndex == nItemIdx)) // 取自定义物品名称
                    {
                        sUserItemName = "";
                        if (UserItem->btValue[13] == 1)
                        {
                            sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                        }
                        if (sUserItemName == "")
                        {
                            sUserItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                        }
                        StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                        if (UserItem->btValue[12] == 1)// 物品发光
                        {
                            StdItem->Reserved1 = 1;
                        }
                        else
                        {
                            StdItem->Reserved1 = 0;
                        }
                        if (StdItem != null)
                        {
                            if ((sUserItemName).ToLower().CompareTo((sItemName).ToLower()) == 0)
                            {
                                n14 = I;
                                break;
                            }
                        }
                    }
                    UserItem = null;
                }
            }
            n18 = 0;
            if ((StdItem != null) && (UserItem != null))
            {
                if (this.CheckIsOKItem(UserItem, 0)) // 检查变态物品
                {
                    n18 = -1;
                    goto FailExit;
                }
                if ((btWhere == 13) && (GameConfig.nIsUseZhuLi == 1)) // 如果没有设置人物可带,则不能带上斗笠
                {
                    n18 = -1;
                    goto FailExit;
                }
                if (this.PlugOfCheckCanItem(8, sUserItemName, false, 0, 0)) // 禁止物品规则(禁止英雄使用)
                {
                    n18 = -1;
                    goto FailExit;
                }
                if (M2Share.CheckUserItems(btWhere, StdItem))
                {
                    StdItem58 = StdItem;
                    ItemUnit.GetItemAddValue(UserItem, StdItem58);
                    if (((THeroObject)(m_MyHero)).CheckTakeOnItems(btWhere, StdItem58))
                    {
                        TakeOffItem = null;
                        if (btWhere >= 0 && btWhere <= 13)  // 支持斗笠,0..12改0..13
                        {
                            if (((THeroObject)(m_MyHero)).m_UseItems[btWhere]->wIndex > 0)
                            {
                                StdItem20 = UserEngine.GetStdItem(((THeroObject)(m_MyHero)).m_UseItems[btWhere]->wIndex);
                                if ((StdItem20 != null))
                                {
                                    switch (StdItem20->StdMode)
                                    {
                                        case 15:
                                        case 16:
                                        case 19:
                                        case 26:
                                            if ((!this.m_boUserUnLockDurg) && (((THeroObject)(m_MyHero)).m_UseItems[btWhere]->btValue[7] != 0))
                                            {
                                                ((THeroObject)(m_MyHero)).SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);// '无法取下物品！！！'
                                                n18 = -4;
                                                goto FailExit;
                                            }
                                            break;
                                    }
                                }
                                if (!this.m_boUserUnLockDurg && ((StdItem20->Reserved & 2) != 0))
                                {
                                    ((THeroObject)(m_MyHero)).SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);  // '无法取下物品！！！'
                                    n18 = -4;
                                    goto FailExit;
                                }
                                if ((StdItem20->Reserved & 4) != 0)
                                {
                                    ((THeroObject)(m_MyHero)).SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);  // '无法取下物品！！！'
                                    n18 = -4;
                                    goto FailExit;
                                }
                                if (M2Share.InDisableTakeOffList(((THeroObject)(m_MyHero)).m_UseItems[btWhere]->wIndex))
                                {
                                    ((THeroObject)(m_MyHero)).SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);   // '无法取下物品！！！'
                                    goto FailExit;
                                }
                                *TakeOffItem = *((THeroObject)(m_MyHero)).m_UseItems[btWhere];
                            }
                            if (UserItem->btValue[8] != 0)
                            {
                                switch (StdItem->StdMode)
                                {
                                    case 15:
                                    case 16:
                                    case 19:
                                    case 26:
                                        UserItem->btValue[8] = 0;
                                        break;
                                }
                            }
                            *((THeroObject)(m_MyHero)).m_UseItems[btWhere] = *UserItem;
                            ((THeroObject)(m_MyHero)).DelBagItem(n14);
                            if (TakeOffItem != null)
                            {
                                if (((THeroObject)(m_MyHero)).AddItemToBag(TakeOffItem))
                                {
                                    ((THeroObject)(m_MyHero)).SendAddItem(TakeOffItem);
                                }
                            }
                            if (btWhere == TPosition.U_BUJUK)
                            {
                                if (!((THeroObject)(m_MyHero)).WearFirDragon())   // 没火龙之心,不显示怒气值 
                                {
                                    ((THeroObject)(m_MyHero)).SendMsg(m_MyHero, Grobal2.RM_FIRDRAGONPOINT, 0, 0, 0, 0, "");// 发送英雄怒气值 
                                }
                            }
                            ((THeroObject)(m_MyHero)).RecalcAbilitys();
                            m_MyHero.CompareSuitItem(true);// 套装与身上装备对比
                            ((THeroObject)(m_MyHero)).SendMsg(m_MyHero, Grobal2.RM_HEROABILITY, 0, 0, 0, 0, "");
                            ((THeroObject)(m_MyHero)).SendMsg(m_MyHero, Grobal2.RM_HEROSUBABILITY, 0, 0, 0, 0, "");
                            ((THeroObject)(m_MyHero)).SendDefMessage(Grobal2.SM_HEROTAKEON_OK, ((THeroObject)(m_MyHero)).GetFeatureToLong(), m_MyHero.GetFeatureEx(), 0, 0, "");
                            ((THeroObject)(m_MyHero)).FeatureChanged();
                            if (StdItem->StdMode == 16)// 如果是斗笠则更新名字
                            {
                                ((THeroObject)(m_MyHero)).RefShowName();// 宝宝也更新名字
                                if (m_MyHero.m_SlaveList.Count > 0)
                                {
                                    for (int I = 0; I < m_MyHero.m_SlaveList.Count; I++)
                                    {
                                        Slave = m_MyHero.m_SlaveList[I];
                                        if ((Slave != null) && (!Slave.m_boDeath))
                                        {
                                            Slave.RefShowName();
                                        }
                                    }
                                }
                            }
                            n18 = 1;
                        }
                    }
                    else
                    {
                        n18 = -2;
                    }
                }
                else
                {
                    n18 = -1;
                }
            }
        FailExit:
            if (n18 <= 0)
            {
                SendDefMessage(Grobal2.SM_HEROTAKEON_FAIL, n18, 0, 0, 0, "");
            }
        }

        /// <summary>
        /// 英雄脱下装备
        /// </summary>
        /// <param name="btWhere"></param>
        /// <param name="nItemIdx"></param>
        /// <param name="sItemName"></param>
        public unsafe void ClientHeroTakeOffItems(byte btWhere, int nItemIdx, string sItemName)
        {
            int n10;
            TStdItem* StdItem;
            TUserItem* UserItem;
            string sUserItemName;
            TBaseObject Slave;
            n10 = 0;
            if ((m_MyHero == null) || m_boWaitHeroDate)
            {
                goto FailExit;
            }
            if (!m_boDealing && (btWhere < 14)) // 支持斗笠
            {
                if (((THeroObject)(m_MyHero)).m_UseItems[btWhere]->wIndex > 0)
                {
                    if (((THeroObject)(m_MyHero)).m_UseItems[btWhere]->MakeIndex == nItemIdx)
                    {
                        StdItem = UserEngine.GetStdItem(((THeroObject)(m_MyHero)).m_UseItems[btWhere]->wIndex);
                        if ((StdItem != null) && (new ArrayList(new int[] { 15, 16, 19, 20, 21, 22, 23, 24, 26 }).Contains(StdItem->StdMode)))
                        {
                            if ((!this.m_boUserUnLockDurg) && (((THeroObject)(m_MyHero)).m_UseItems[btWhere]->btValue[7] != 0))
                            {
                                ((THeroObject)(m_MyHero)).SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);//无法取下物品！！！
                                n10 = -4;
                                goto FailExit;
                            }
                        }
                        if (!this.m_boUserUnLockDurg && ((StdItem->Reserved & 2) != 0))
                        {
                            ((THeroObject)(m_MyHero)).SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint); // '无法取下物品！！！'
                            n10 = -4;
                            goto FailExit;
                        }
                        if ((StdItem->Reserved & 4) != 0)
                        {
                            ((THeroObject)(m_MyHero)).SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);  // '无法取下物品！！！'
                            n10 = -4;
                            goto FailExit;
                        }
                        if (M2Share.InDisableTakeOffList(((THeroObject)(m_MyHero)).m_UseItems[btWhere]->wIndex))
                        {
                            ((THeroObject)(m_MyHero)).SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);// '无法取下物品！！！'
                            goto FailExit;
                        }
                        // 取自定义物品名称
                        sUserItemName = "";
                        if (((THeroObject)(m_MyHero)).m_UseItems[btWhere]->btValue[13] == 1)
                        {
                            sUserItemName = ItemUnit.GetCustomItemName(((THeroObject)(m_MyHero)).m_UseItems[btWhere]->MakeIndex, ((THeroObject)(m_MyHero)).m_UseItems[btWhere]->wIndex);
                        }
                        if (sUserItemName == "")
                        {
                            sUserItemName = UserEngine.GetStdItemName(((THeroObject)(m_MyHero)).m_UseItems[btWhere]->wIndex);
                        }
                        if ((sUserItemName).ToLower().CompareTo((sItemName).ToLower()) == 0)
                        {
                            UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                            for (int i = 0; i < 22; i++)
                            {
                                UserItem->btValue[i] = 0;
                            }
                            UserItem = ((THeroObject)(m_MyHero)).m_UseItems[btWhere];
                            if (((THeroObject)(m_MyHero)).AddItemToBag(UserItem))
                            {
                                ((THeroObject)(m_MyHero)).m_UseItems[btWhere]->wIndex = 0;
                                ((THeroObject)(m_MyHero)).SendAddItem(UserItem);
                                ((THeroObject)(m_MyHero)).RecalcAbilitys();
                                m_MyHero.CompareSuitItem(false);  // 套装与身上装备对比
                                ((THeroObject)(m_MyHero)).SendMsg(m_MyHero, Grobal2.RM_HEROABILITY, 0, 0, 0, 0, "");
                                ((THeroObject)(m_MyHero)).SendMsg(m_MyHero, Grobal2.RM_HEROSUBABILITY, 0, 0, 0, 0, "");
                                ((THeroObject)(m_MyHero)).SendDefMessage(Grobal2.SM_HEROTAKEOFF_OK, ((THeroObject)(m_MyHero)).GetFeatureToLong(), m_MyHero.GetFeatureEx(), 0, 0, "");
                                ((THeroObject)(m_MyHero)).FeatureChanged();
                                if (StdItem->StdMode == 16)
                                {
                                    ((THeroObject)(m_MyHero)).RefShowName();// 如果是斗笠则更新名字
                                    if (m_MyHero.m_SlaveList.Count > 0) //宝宝也更新名字
                                    {
                                        for (int I = 0; I < m_MyHero.m_SlaveList.Count; I++)
                                        {
                                            Slave = ((m_MyHero.m_SlaveList[I]) as TBaseObject);
                                            if ((Slave != null) && (!Slave.m_boDeath))
                                            {
                                                Slave.RefShowName();
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                Marshal.FreeHGlobal((IntPtr)UserItem);
                                n10 = -3;
                            }
                        }
                    }
                }
                else
                {
                    n10 = -2;
                }
            }
            else
            {
                n10 = -1;
            }
        FailExit:
            if (n10 <= 0)
            {
                SendDefMessage(Grobal2.SM_HEROTAKEOFF_FAIL, n10, 0, 0, 0, "");
            }
        }


        public unsafe void ClientHeroTakeOffItemsToBag(int nIndex, byte btWhere, int nItemIdx, string sItemName)
        {
            int n10;
            TStdItem* StdItem;
            TUserItem* UserItem;
            string sUserItemName;
            n10 = 0;
            if ((m_MyHero == null) || m_boWaitHeroDate)
            {
                goto FailExit;
            }
            switch (nIndex)
            {
                case Grobal2.CM_TAKEOFFITEMHEROBAG:// 装备脱下到英雄包裹
                    if (!m_boDealing && (btWhere < 13))
                    {
                        if (this.m_UseItems[btWhere]->wIndex > 0)
                        {
                            if (this.m_UseItems[btWhere]->MakeIndex == nItemIdx)
                            {
                                StdItem = UserEngine.GetStdItem(this.m_UseItems[btWhere]->wIndex);
                                if ((StdItem != null) && (new ArrayList(new int[] { 15, 16, 19, 20, 21, 22, 23, 24, 26 }).Contains(StdItem->StdMode)))
                                {
                                    if ((!this.m_boUserUnLockDurg) && (((THeroObject)(m_MyHero)).m_UseItems[btWhere]->btValue[7] != 0))
                                    {
                                        // '无法取下物品！！！'
                                        this.SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);
                                        n10 = -4;
                                        goto FailExit;
                                    }
                                }
                                if (!this.m_boUserUnLockDurg && ((StdItem->Reserved & 2) != 0))
                                {
                                    // '无法取下物品！！！'
                                    this.SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);
                                    n10 = -4;
                                    goto FailExit;
                                }
                                if ((StdItem->Reserved & 4) != 0)
                                {
                                    // '无法取下物品！！！'
                                    this.SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);
                                    n10 = -4;
                                    goto FailExit;
                                }
                                if (M2Share.InDisableTakeOffList(this.m_UseItems[btWhere]->wIndex))
                                {
                                    // '无法取下物品！！！'
                                    this.SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);
                                    goto FailExit;
                                }
                                // 取自定义物品名称
                                sUserItemName = "";
                                if (this.m_UseItems[btWhere]->btValue[13] == 1)
                                {
                                    sUserItemName = ItemUnit.GetCustomItemName(this.m_UseItems[btWhere]->MakeIndex, this.m_UseItems[btWhere]->wIndex);
                                }
                                if (sUserItemName == "")
                                {
                                    sUserItemName = UserEngine.GetStdItemName(this.m_UseItems[btWhere]->wIndex);
                                }
                                if ((sUserItemName).ToLower().CompareTo((sItemName).ToLower()) == 0)
                                {
                                    UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                                    for (int i = 0; i < 22; i++)
                                    {
                                        UserItem->btValue[i] = 0;
                                    }
                                    *UserItem = *this.m_UseItems[btWhere];
                                    if (((THeroObject)(m_MyHero)).AddItemToBag(UserItem))
                                    {
                                        ((THeroObject)(m_MyHero)).SendAddItem(UserItem);
                                        this.m_UseItems[btWhere]->wIndex = 0;
                                        RecalcAbilitys();
                                        this.CompareSuitItem(false);//套装
                                        this.SendMsg(this, Grobal2.RM_ABILITY, 0, 0, 0, 0, "");
                                        this.SendMsg(this, Grobal2.RM_SUBABILITY, 0, 0, 0, 0, "");
                                        SendDefMessage(Grobal2.SM_TAKEOFFTOHEROBAG_OK, this.GetFeatureToLong(), this.GetFeatureEx(), 0, 0, "");
                                        this.FeatureChanged();
                                        n10 = 1;
                                    }
                                    else
                                    {
                                        Marshal.FreeHGlobal((IntPtr)UserItem);
                                        n10 = -3;
                                    }
                                }
                            }
                        }
                        else
                        {
                            n10 = -2;
                        }
                    }
                    else
                    {
                        n10 = -1;
                    }
                    break;
                case Grobal2.CM_TAKEOFFITEMTOMASTERBAG:// 装备脱下到主人包裹
                    if (!m_boDealing && (btWhere < 13))
                    {
                        if (((THeroObject)(m_MyHero)).m_UseItems[btWhere]->wIndex > 0)
                        {
                            if (((THeroObject)(m_MyHero)).m_UseItems[btWhere]->MakeIndex == nItemIdx)
                            {
                                StdItem = UserEngine.GetStdItem(((THeroObject)(m_MyHero)).m_UseItems[btWhere]->wIndex);
                                if ((StdItem != null) && (new ArrayList(new int[] { 15, 16, 19, 20, 21, 22, 23, 24, 26 }).Contains(StdItem->StdMode)))
                                {
                                    if ((!this.m_boUserUnLockDurg) && (((THeroObject)(m_MyHero)).m_UseItems[btWhere]->btValue[7] != 0))
                                    {
                                        ((THeroObject)(m_MyHero)).SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);// '无法取下物品！！！'
                                        n10 = -4;
                                        goto FailExit;
                                    }
                                }
                                if (!this.m_boUserUnLockDurg && ((StdItem->Reserved & 2) != 0))
                                {
                                    // '无法取下物品！！！'
                                    ((THeroObject)(m_MyHero)).SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);
                                    n10 = -4;
                                    goto FailExit;
                                }
                                if ((StdItem->Reserved & 4) != 0)
                                {
                                    // '无法取下物品！！！'
                                    ((THeroObject)(m_MyHero)).SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);
                                    n10 = -4;
                                    goto FailExit;
                                }
                                if (M2Share.InDisableTakeOffList(((THeroObject)(m_MyHero)).m_UseItems[btWhere]->wIndex))
                                {
                                    // '无法取下物品！！！'
                                    ((THeroObject)(m_MyHero)).SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);
                                    goto FailExit;
                                }
                                // 取自定义物品名称
                                sUserItemName = "";

                                if (((THeroObject)(m_MyHero)).m_UseItems[btWhere]->btValue[13] == 1)
                                {
                                    sUserItemName = ItemUnit.GetCustomItemName(((THeroObject)(m_MyHero)).m_UseItems[btWhere]->MakeIndex, ((THeroObject)(m_MyHero)).m_UseItems[btWhere]->wIndex);
                                }
                                if (sUserItemName == "")
                                {
                                    sUserItemName = UserEngine.GetStdItemName(((THeroObject)(m_MyHero)).m_UseItems[btWhere]->wIndex);
                                }
                                if ((sUserItemName).ToLower().CompareTo((sItemName).ToLower()) == 0)
                                {
                                    UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                                    for (int i = 0; i < 22; i++)
                                    {
                                        UserItem->btValue[i] = 0;
                                    }
                                    *UserItem = *((THeroObject)(m_MyHero)).m_UseItems[btWhere];
                                    if (this.AddItemToBag(UserItem))
                                    {
                                        SendAddItem(UserItem);
                                        this.WeightChanged();
                                        ((THeroObject)(m_MyHero)).m_UseItems[btWhere]->wIndex = 0;
                                        ((THeroObject)(m_MyHero)).RecalcAbilitys();
                                        m_MyHero.CompareSuitItem(false);// 套装
                                        ((THeroObject)(m_MyHero)).WeightChanged();
                                        ((THeroObject)(m_MyHero)).SendMsg(m_MyHero, Grobal2.RM_HEROABILITY, 0, 0, 0, 0, "");
                                        ((THeroObject)(m_MyHero)).SendMsg(m_MyHero, Grobal2.RM_HEROSUBABILITY, 0, 0, 0, 0, "");
                                        ((THeroObject)(m_MyHero)).SendDefMessage(Grobal2.SM_TAKEOFFTOMASTERBAG_OK, ((THeroObject)(m_MyHero)).GetFeatureToLong(), m_MyHero.GetFeatureEx(), 0, 0, "");
                                        ((THeroObject)(m_MyHero)).FeatureChanged();
                                        n10 = 1;
                                    }
                                    else
                                    {
                                        Marshal.FreeHGlobal((IntPtr)UserItem);
                                        n10 = -3;
                                    }
                                }
                            }
                        }
                        else
                        {
                            n10 = -2;
                        }
                    }
                    else
                    {
                        n10 = -1;
                    }
                    break;
            }
        FailExit:
            switch (nIndex)
            {
                case Grobal2.CM_TAKEOFFITEMHEROBAG:// 装备脱下到英雄包裹
                    if (n10 <= 0)
                    {
                        SendDefMessage(Grobal2.SM_TAKEOFFTOHEROBAG_FAIL, n10, 0, 0, 0, "");
                    }
                    break;
                case Grobal2.CM_TAKEOFFITEMTOMASTERBAG:// 装备脱下到主人包裹
                    if (n10 <= 0)
                    {
                        SendDefMessage(Grobal2.SM_TAKEOFFTOMASTERBAG_FAIL, n10, 0, 0, 0, "");
                    }
                    break;
            }
        }

        /// <summary>
        /// 包裹到包裹
        /// </summary>
        /// <param name="nIndex"></param>
        /// <param name="nItemIdx"></param>
        /// <param name="sItemName"></param>
        public unsafe void ClientBagToBag(int nIndex, int nItemIdx, string sItemName)
        {
            int I;
            int n10;
            int wIndex;
            int MakeIndex;
            TStdItem* StdItem;
            TUserItem* UserItem;
            string sUserItemName;
            n10 = 0;
            if ((m_MyHero == null) || m_boWaitHeroDate || m_boHeroLogOut)
            {
                goto FailExit;
            }
            switch (nIndex)
            {
                case Grobal2.CM_SENDITEMTOHEROBAG:// 主人包裹到英雄包裹
                    for (I = this.m_ItemList.Count - 1; I >= 0; I--)
                    {
                        if (this.m_ItemList.Count <= 0)
                        {
                            break;
                        }
                        UserItem = (TUserItem*)this.m_ItemList[I];
                        if (UserItem->MakeIndex == nItemIdx)
                        {
                            if (this.PlugOfCheckCanItem(8, sItemName, false, 0, 0))// 禁止物品规则,禁止英雄使用(管理插件功能)
                            {
                                goto FailExit;
                            }
                            StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                            if (StdItem == null)
                            {
                                goto FailExit;
                            }
                            // 取自定义物品名称
                            sUserItemName = "";
                            if (UserItem->btValue[13] == 1)
                            {
                                sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                            }
                            if (sUserItemName == "")
                            {
                                sUserItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                            }
                            if (((sUserItemName).ToLower().CompareTo((sItemName).ToLower()) == 0) && (((m_sHeroCharName).ToLower().CompareTo((m_MyHero.m_sCharName).ToLower()) == 0) || ((m_sDeputyHeroCharName).ToLower().CompareTo((m_MyHero.m_sCharName).ToLower()) == 0)))
                            {
                                ((THeroObject)(m_MyHero)).ClearCopyItem(UserItem->wIndex, UserItem->MakeIndex);// 先清理英雄包裹复制品
                                if (m_boHeroLogOut)// 英雄退出,则失败
                                {

                                    goto FailExit;
                                }
                                if (((THeroObject)(m_MyHero)).AddItemToBag(UserItem))
                                {
                                    this.m_ItemList.RemoveAt(I);
                                    ((THeroObject)(m_MyHero)).SendAddItem(UserItem);
                                    IsItem_51(1);// 发送聚灵珠的经验
                                    ((THeroObject)(m_MyHero)).SendDefMessage(Grobal2.SM_SENDITEMTOHEROBAG_OK, 0, 0, 0, 0, "");
                                    this.WeightChanged();// 负重改变
                                    ((THeroObject)(m_MyHero)).WeightChanged();// 负重改变
                                    n10 = 1;
                                }
                                else
                                {
                                    n10 = -3;
                                }
                                break;
                            }
                        }
                    }
                    break;
                case Grobal2.CM_SENDITEMTOMASTERBAG:// 英雄包裹到主人包裹
                    for (I = m_MyHero.m_ItemList.Count - 1; I >= 0; I--)
                    {
                        if (m_MyHero.m_ItemList.Count <= 0)
                        {
                            break;
                        }
                        UserItem = (TUserItem*)m_MyHero.m_ItemList[I];
                        if (UserItem->MakeIndex == nItemIdx)
                        {
                            StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                            if (StdItem == null)
                            {
                                goto FailExit;
                            }
                            // 取自定义物品名称
                            sUserItemName = "";
                            if (UserItem->btValue[13] == 1)
                            {
                                sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                            }
                            if (sUserItemName == "")
                            {
                                sUserItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                            }
                            if (((sUserItemName).ToLower().CompareTo((sItemName).ToLower()) == 0) && (((m_sHeroCharName).ToLower().CompareTo((m_MyHero.m_sCharName).ToLower()) == 0) || ((m_sDeputyHeroCharName).ToLower().CompareTo((m_MyHero.m_sCharName).ToLower()) == 0)))
                            {
                                ClearCopyItem(0, UserItem->wIndex, UserItem->MakeIndex);
                                if (m_boHeroLogOut) // 英雄退出,则失败
                                {
                                    goto FailExit;
                                }
                                if (this.AddItemToBag(UserItem))
                                {
                                    m_MyHero.m_ItemList.RemoveAt(I);
                                    wIndex = UserItem->wIndex;
                                    MakeIndex = UserItem->MakeIndex;
                                    ((THeroObject)(m_MyHero)).ClearCopyItem(wIndex, MakeIndex);
                                    SendAddItem(UserItem);
                                    IsItem_51(1);// 发送聚灵珠的经验
                                    SendDefMessage(Grobal2.SM_SENDITEMTOMASTERBAG_OK, 0, 0, 0, 0, "");
                                    this.WeightChanged();// 负重改变
                                    ((THeroObject)(m_MyHero)).WeightChanged();// 负重改变
                                    n10 = 1;
                                }
                                else
                                {
                                    n10 = -3;
                                }
                                break;
                            }
                        }
                    }
                    break;
            }
        FailExit:
            switch (nIndex)
            {
                case Grobal2.CM_SENDITEMTOHEROBAG:// 主人包裹到英雄包裹
                    if (n10 <= 0)
                    {
                        SendDefMessage(Grobal2.SM_SENDITEMTOHEROBAG_FAIL, n10, 0, 0, 0, "");
                    }
                    break;
                case Grobal2.CM_SENDITEMTOMASTERBAG:// 英雄包裹到主人包裹
                    if (n10 <= 0)
                    {
                        SendDefMessage(Grobal2.SM_SENDITEMTOMASTERBAG_FAIL, n10, 0, 0, 0, "");
                    }
                    break;
            }
        }

        /// <summary>
        /// 英雄使用物品
        /// </summary>
        /// <param name="nItemIdx"></param>
        /// <param name="sItemName"></param>
        private void ClientHeroUseItems(int nItemIdx, string sItemName)
        {
            if (m_boWaitHeroDate)
            {
                return;
            }
            if (((THeroObject)(m_MyHero)) != null)
            {
                ((THeroObject)(m_MyHero)).ClientHeroUseItems(nItemIdx, sItemName);
            }
        }

        // 用户排行
        public List<string> ClientGetUserOrder_GetSortStringList(int nSortType, int nType)
        {
            List<string> result;
            result = null;
            switch (nSortType)
            {
                case 0:
                    switch (nType)
                    {
                        case 1:
                            // result = UserEngine.m_PlayObjectLevelList;
                            break;
                        case 2:
                            // result = UserEngine.m_WarrorObjectLevelList;
                            break;
                        case 3:
                            // result = UserEngine.m_WizardObjectLevelList;
                            break;
                        case 4:
                            // result = UserEngine.m_TaoistObjectLevelList;
                            break;
                    }
                    break;
                case 1:
                    switch (nType)
                    {
                        case 1:
                            // result = UserEngine.m_HeroObjectLevelList;
                            break;
                        case 2:
                            //result = UserEngine.m_WarrorHeroObjectLevelList;
                            break;
                        case 3:
                            // result = UserEngine.m_WizardHeroObjectLevelList;
                            break;
                        case 4:
                            // result = UserEngine.m_TaoistHeroObjectLevelList;
                            break;
                    }
                    break;
                case 2:
                    // result = UserEngine.m_PlayObjectMasterList;
                    break;
            }
            return result;
        }

        public int ClientGetUserOrder_GetPageCount(List<string> List)
        {
            int result;
            result = List.Count / 10;
            if (List.Count % 10 > 0)
            {
                result++;
            }
            return result;
        }

        // nSortType 0-人物榜 1-英雄榜 2-师徒榜
        // nType 1-等级榜 2-战士榜 3-法师榜 4-道士榜
        private void ClientGetUserOrder(int nSortType, int nType, int nPage)
        {
            string sCharName = string.Empty;
            string sHeroName = string.Empty;
            int nIndex;
            List<string> StringList;
            int n01;
            int nPageCount;
            int nBeginPage;
            string sSendText;
            TUserLevelSort UserLevelSort = null;
            THeroLevelSort HeroLevelSort = null;
            TUserMasterSort UserMasterSort = null;
            string CharName = string.Empty;
            string HeroName = string.Empty;
            byte nCode;
            HUtil32.EnterCriticalSection(M2Share.HumanSortCriticalSection);
            try
            {
                nCode = 0;
                try
                {
                    StringList = ClientGetUserOrder_GetSortStringList(nSortType, nType);
                    nCode = 1;
                    if (StringList != null)
                    {
                        n01 = 0;
                        sSendText = "";
                        nPageCount = ClientGetUserOrder_GetPageCount(StringList);
                        nCode = 2;
                        nBeginPage = nPage;
                        if (nPage >= nPageCount)
                        {
                            nBeginPage = nPageCount - 1;
                        }
                        if (nBeginPage < 0)
                        {
                            nBeginPage = 0;
                        }
                        if (nPage < 0)
                        {
                            // 我的排行
                            for (nIndex = 0; nIndex < StringList.Count; nIndex++)
                            {
                                sCharName = "";
                                nCode = 3;
                                if (nSortType == 1)
                                {
                                    //HeroName = ((string[])(StringList[nIndex]));
                                    if (HeroName != null)
                                    {
                                        sHeroName = HeroName;
                                    }
                                    sHeroName = HUtil32.GetValidStr3(sHeroName, ref sCharName, new string[] { "\r" });
                                }
                                else
                                {
                                    CharName = ((string)(StringList[nIndex]));
                                    if (CharName != null)
                                    {
                                        sCharName = CharName;
                                    }
                                }
                                nCode = 4;
                                if ((sCharName != "") && (sCharName == this.m_sCharName))
                                {
                                    switch (nSortType)
                                    {
                                        case 0:
                                            nCode = 5;
                                            //UserLevelSort.nIndex = nIndex + 1;
                                            //UserLevelSort.wLevel = HUtil32.Str_ToInt(StringList[nIndex], 0);
                                            // 20081222
                                            if (UserLevelSort.wLevel > 0)
                                            {
                                                //UserLevelSort.sChrName = sCharName;
                                                //sSendText = sSendText + EncryptUnit.EncodeBuffer(UserLevelSort, sizeof(TUserLevelSort)) + "/";
                                            }
                                            break;
                                        case 1:
                                            nCode = 6;
                                            // HeroLevelSort.nIndex = nIndex + 1;
                                            //HeroLevelSort.wLevel = HUtil32.Str_ToInt(StringList[nIndex], 0);
                                            // 20081222
                                            if (HeroLevelSort.wLevel > 0)
                                            {
                                                HeroLevelSort.sChrName = sCharName;
                                                HeroLevelSort.sHeroName = sHeroName;
                                                //sSendText = sSendText + EncryptUnit.EncodeBuffer(HeroLevelSort, sizeof(THeroLevelSort)) + "/";
                                            }
                                            break;
                                        case 2:
                                            nCode = 7;
                                            // UserMasterSort.nIndex = nIndex + 1;
                                            // UserMasterSort.nMasterCount := StrToInt(StringList.Strings[nIndex]);
                                            UserMasterSort.nMasterCount = HUtil32.Str_ToInt(StringList[nIndex], 0);
                                            // 20081222
                                            if (UserMasterSort.nMasterCount > 0)
                                            {
                                                //UserMasterSort.sChrName = CharName;
                                                //sSendText = sSendText + EncryptUnit.EncodeBuffer(UserMasterSort, sizeof(TUserMasterSort)) + "/";
                                            }
                                            break;
                                    }
                                    break;
                                }
                            }
                        }
                        else
                        {
                            nCode = 8;
                            for (nIndex = nBeginPage * 10; nIndex < StringList.Count; nIndex++)
                            {
                                if (n01 >= 10)
                                {
                                    break;
                                }
                                switch (nSortType)
                                {
                                    case 0:
                                        nCode = 9;
                                        UserLevelSort.nIndex = nIndex + 1;
                                        nCode = 95;
                                        //UserLevelSort.wLevel = HUtil32.Str_ToInt(StringList[nIndex], 0);
                                        nCode = 92;
                                        //CharName = ((string[])(StringList.Values[nIndex]));
                                        if ((CharName != null) && (UserLevelSort.wLevel > 0))
                                        {
                                            // 20081204
                                            nCode = 93;
                                            // UserLevelSort.sChrName = CharName;
                                            nCode = 94;
                                            //sSendText = sSendText + EncryptUnit.EncodeBuffer(UserLevelSort, sizeof(TUserLevelSort)) + "/";
                                        }
                                        break;
                                    case 1:
                                        nCode = 10;
                                        HeroLevelSort.nIndex = nIndex + 1;
                                        nCode = 108;
                                        //HeroLevelSort.wLevel = HUtil32.Str_ToInt(StringList[nIndex], 0);
                                        nCode = 102;
                                        // HeroName = ((string[])(StringList.Values[nIndex]));
                                        nCode = 103;
                                        if ((HeroName != null) && (HeroLevelSort.wLevel > 0))
                                        {
                                            nCode = 104;
                                            sHeroName = HeroName;
                                            nCode = 105;
                                            sHeroName = HUtil32.GetValidStr3(sHeroName, ref sCharName, new string[] { "\r" });
                                            nCode = 106;
                                            HeroLevelSort.sChrName = sCharName;
                                            HeroLevelSort.sHeroName = sHeroName;
                                            nCode = 107;
                                            //sSendText = sSendText + EncryptUnit.EncodeBuffer(HeroLevelSort, sizeof(THeroLevelSort)) + "/";
                                        }
                                        break;
                                    case 2:
                                        nCode = 11;
                                        UserMasterSort.nIndex = nIndex + 1;
                                        // UserMasterSort.nMasterCount := StrToInt(StringList.Strings[nIndex]);
                                        UserMasterSort.nMasterCount = HUtil32.Str_ToInt(StringList[nIndex], 0);
                                        if (UserMasterSort.nMasterCount > 0)
                                        {
                                            //CharName = ((string[])(StringList[nIndex]));
                                            UserMasterSort.sChrName = CharName;
                                            // sSendText = sSendText + EncryptUnit.EncodeBuffer(UserMasterSort, sizeof(TUserMasterSort)) + "/";
                                        }
                                        break;
                                }
                                n01++;
                            }
                        }
                        nCode = 12;
                        if (nPage >= 0)
                        {
                            nCode = 13;
                            if (sSendText != "")
                            {
                                // 客户端对应Param   Recog     Tag     Series
                                this.SendMsg(this, Grobal2.RM_QUERYUSERLEVELSORT, nPage, nSortType, nType, nPageCount, sSendText);
                            }
                        }
                        else
                        {
                            nCode = 14;
                            if (sSendText != "")
                            {
                                this.SendMsg(this, Grobal2.RM_QUERYUSERLEVELSORT, nPage, nSortType, nType, 0, sSendText);
                            }
                            else
                            {
                                this.SendMsg(this, Grobal2.RM_QUERYUSERLEVELSORT, nPage, -1, nType, 0, "");
                            }
                        }
                    }
                }
                catch
                {
                    M2Share.MainOutMessage("{异常} TPlayObject.ClientGetUserOrder Code:" + (nCode).ToString());
                }
            }
            finally
            {
                HUtil32.LeaveCriticalSection(M2Share.HumanSortCriticalSection);
            }
        }

        /// <summary>
        /// 人物:把包裹物品到身上
        /// </summary>
        /// <param name="btWhere"></param>
        /// <param name="nItemIdx"></param>
        /// <param name="sItemName"></param>
        public unsafe void ClientTakeOnItems(byte btWhere, int nItemIdx, string sItemName)
        {
            int I;
            int n14;
            int n18;
            TUserItem* UserItem;
            TUserItem* TakeOffItem;
            TStdItem* StdItem;
            TStdItem* StdItem20;
            TStdItem* StdItem58;
            string sUserItemName;
            TBaseObject Slave;
            StdItem = null;
            UserItem = null;
            n14 = -1;
            if (this.m_ItemList.Count > 0)
            {
                for (I = 0; I < this.m_ItemList.Count; I++)
                {
                    UserItem = (TUserItem*)this.m_ItemList[I];
                    if ((UserItem != null) && (UserItem->MakeIndex == nItemIdx))// 取自定义物品名称
                    {
                        sUserItemName = "";
                        if (UserItem->btValue[13] == 1)
                        {
                            sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                        }
                        if (sUserItemName == "")
                        {
                            sUserItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                        }
                        StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                        if (UserItem->btValue[12] == 1)// 物品发光
                        {
                            StdItem->Reserved1 = 1;
                        }
                        else
                        {
                            StdItem->Reserved1 = 0;
                        }
                        if (StdItem != null)
                        {
                            if ((sUserItemName).ToLower().CompareTo((sItemName).ToLower()) == 0)
                            {
                                n14 = I;
                                break;
                            }
                        }
                    }
                    UserItem = null;
                }
            }
            n18 = 0;
            if ((StdItem != null) && (UserItem != null))
            {
                if (this.CheckIsOKItem(UserItem, 0)) // 检查变态物品
                {
                    n18 = -1;
                    goto FailExit;
                }
                if ((btWhere == 13) && (GameConfig.nIsUseZhuLi > 1))// 如果没有设置人物可带,则不能带上斗笠
                {
                    n18 = -1;
                    goto FailExit;
                }
                if (M2Share.CheckUserItems(btWhere, StdItem))
                {
                    StdItem58 = StdItem;
                    ItemUnit.GetItemAddValue(UserItem, StdItem58);
                    if (CheckTakeOnItems(btWhere, StdItem58) && CheckItemBindUse(UserItem))
                    {
                        TakeOffItem = null;
                        if (btWhere >= 0 && btWhere <= 13)
                        {
                            if (this.m_UseItems[btWhere]->wIndex > 0)
                            {
                                StdItem20 = UserEngine.GetStdItem(this.m_UseItems[btWhere]->wIndex);
                                if (StdItem20 != null)
                                {
                                    switch (StdItem20->StdMode)
                                    {
                                        case 15:
                                        case 16:
                                        case 19:
                                        case 20:
                                        case 21:
                                        case 22:
                                        case 23:
                                        case 24:
                                        case 26:
                                            if ((!this.m_boUserUnLockDurg) && (this.m_UseItems[btWhere]->btValue[7] != 0))
                                            {
                                                this.SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint); // '无法取下物品！！！'
                                                n18 = -4;
                                                goto FailExit;
                                            }
                                            break;
                                    }
                                }
                                if (!this.m_boUserUnLockDurg && ((StdItem20->Reserved & 2) != 0))
                                {
                                    // '无法取下物品！！！'
                                    this.SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);
                                    n18 = -4;
                                    goto FailExit;
                                }
                                if ((StdItem20->Reserved & 4) != 0)
                                {
                                    // '无法取下物品！！！'
                                    this.SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);
                                    n18 = -4;
                                    goto FailExit;
                                }
                                if (M2Share.InDisableTakeOffList(this.m_UseItems[btWhere]->wIndex))
                                {
                                    // '无法取下物品！！！'
                                    this.SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);
                                    goto FailExit;
                                }
                                TakeOffItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));//By Dr.Kevin修正此处没有申请内存地址，导致程序报错
                                TakeOffItem = this.m_UseItems[btWhere];
                            }
                            if (UserItem->btValue[8] != 0)
                            {
                                switch (StdItem->StdMode)
                                {
                                    case 15:
                                    case 16:
                                    case 19:
                                    case 26:
                                        UserItem->btValue[8] = 0;
                                        break;
                                }
                            }
                            *this.m_UseItems[btWhere] = *UserItem;
                            this.DelBagItem(n14);
                            if (TakeOffItem != null)
                            {
                                this.AddItemToBag(TakeOffItem);
                                SendAddItem(TakeOffItem);
                            }
                            RecalcAbilitys();
                            if (btWhere != TPosition.U_BUJUK)// 物品位,不进入触发,以避免施毒术时不停的触发
                            {
                                this.CompareSuitItem(true);// 套装与身上装备对比
                            }
                            else
                            {
                                this.CompareSuitItem(false);
                            }
                            this.SendMsg(this, Grobal2.RM_ABILITY, 0, 0, 0, 0, "");
                            this.SendMsg(this, Grobal2.RM_SUBABILITY, 0, 0, 0, 0, "");
                            SendDefMessage(Grobal2.SM_TAKEON_OK, this.GetFeatureToLong(), this.GetFeatureEx(), 0, 0, "");
                            this.FeatureChanged();
                            if (StdItem->StdMode == 16) // 如果是斗笠则更新名字
                            {
                                this.RefShowName();  //宝宝也更新名字
                                if (this.m_SlaveList.Count > 0)
                                {
                                    for (I = 0; I < this.m_SlaveList.Count; I++)
                                    {
                                        Slave = this.m_SlaveList[I];
                                        if ((Slave != null) && (!Slave.m_boDeath))
                                        {
                                            Slave.RefShowName();
                                        }
                                    }
                                }
                            }
                            n18 = 1;
                        }
                    }
                    else
                    {
                        n18 = -1;
                    }
                }
                else
                {
                    n18 = -1;
                }
            }
        FailExit:
            if (n18 <= 0)
            {
                SendDefMessage(Grobal2.SM_TAKEON_FAIL, n18, 0, 0, 0, "");
            }
        }

        /// <summary>
        /// 人物装配装备到身上的装备位置
        /// </summary>
        /// <param name="btWhere"></param>
        /// <param name="nItemIdx"></param>
        /// <param name="sItemName"></param>
        public unsafe void ClientTakeOffItems(byte btWhere, int nItemIdx, string sItemName)
        {
            int n10;
            int I;
            TStdItem* StdItem;
            TUserItem* UserItem;
            string sUserItemName;
            TBaseObject Slave;
            n10 = 0;
            if (!m_boDealing && (btWhere < 14))
            {
                if (this.m_UseItems[btWhere]->wIndex > 0)
                {
                    if (this.m_UseItems[btWhere]->MakeIndex == nItemIdx)
                    {
                        StdItem = UserEngine.GetStdItem(this.m_UseItems[btWhere]->wIndex);
                        if ((StdItem != null) && (new ArrayList(new int[] { 15, 16, 19, 20, 21, 22, 23, 24, 26 }).Contains(StdItem->StdMode)))
                        {
                            if ((!this.m_boUserUnLockDurg) && (this.m_UseItems[btWhere]->btValue[7] != 0))
                            {
                                // '无法取下物品！！！'
                                this.SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);
                                n10 = -4;
                                goto FailExit;
                            }
                        }
                        // 因为虎啸装备 是吸血成功的几率所以所不能使用 StdItem->Reserved 判断
                        // Shape=193 Need-(30)需等级，Stock-为吸血点 NeedLevel-所需等级 Reserved-成功机率
                        // Shape=193 Need-(31)需攻击，Stock-为吸血点 NeedLevel-所需攻击 Reserved-成功机率
                        // Shape=193 Need-(32)需魔法，Stock-为吸血点 NeedLevel-所需魔法 Reserved-成功机率
                        // Shape=193 Need-(33)需道术，Stock-为吸血点 NeedLevel-所需道术 Reserved-成功机率
                        if (!(StdItem->Shape == 193))
                        {
                            if (!this.m_boUserUnLockDurg && ((StdItem->Reserved & 2) != 0))
                            {
                                // '无法取下物品！！！'
                                this.SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);
                                n10 = -4;
                                goto FailExit;
                            }
                            if ((StdItem->Reserved & 4) != 0)
                            {
                                // '无法取下物品！！！'
                                this.SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);
                                n10 = -4;
                                goto FailExit;
                            }
                        }
                        if (M2Share.InDisableTakeOffList(this.m_UseItems[btWhere]->wIndex))
                        {
                            // '无法取下物品！！！'
                            this.SysMsg(GameMsgDef.g_sCanotTakeOffItem, TMsgColor.c_Red, TMsgType.t_Hint);
                            goto FailExit;
                        }
                        // 取自定义物品名称
                        sUserItemName = "";
                        if (this.m_UseItems[btWhere]->btValue[13] == 1)
                        {
                            sUserItemName = ItemUnit.GetCustomItemName(this.m_UseItems[btWhere]->MakeIndex, this.m_UseItems[btWhere]->wIndex);
                        }
                        if (sUserItemName == "")
                        {
                            sUserItemName = UserEngine.GetStdItemName(this.m_UseItems[btWhere]->wIndex);
                        }
                        if ((sUserItemName).ToLower().CompareTo((sItemName).ToLower()) == 0)
                        {
                            UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                            for (int i = 0; i < 22; i++)
                            {
                                UserItem->btValue[i] = 0;
                            }
                            *UserItem = *this.m_UseItems[btWhere];
                            if (this.AddItemToBag(UserItem))
                            {
                                this.m_UseItems[btWhere]->wIndex = 0;
                                SendAddItem(UserItem);
                                RecalcAbilitys();
                                this.CompareSuitItem(false);// 套装与身上装备对比
                                this.SendMsg(this, Grobal2.RM_ABILITY, 0, 0, 0, 0, "");
                                this.SendMsg(this, Grobal2.RM_SUBABILITY, 0, 0, 0, 0, "");
                                SendDefMessage(Grobal2.SM_TAKEOFF_OK, this.GetFeatureToLong(), this.GetFeatureEx(), 0, 0, "");
                                this.FeatureChanged();
                                if (StdItem->StdMode == 16) // 如果是斗笠则更新名字
                                {
                                    this.RefShowName(); // 宝宝也更新名字
                                    if (this.m_SlaveList.Count > 0)
                                    {
                                        for (I = 0; I < this.m_SlaveList.Count; I++)
                                        {
                                            Slave = ((this.m_SlaveList[I]) as TBaseObject);
                                            if ((Slave != null) && (!Slave.m_boDeath))
                                            {
                                                Slave.RefShowName();
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                Marshal.FreeHGlobal((IntPtr)UserItem);
                                UserItem = null;
                                n10 = -3;
                            }
                        }
                    }
                }
                else
                {
                    n10 = -2;
                }
            }
            else
            {
                n10 = -1;
            }
        FailExit:
            if (n10 <= 0)
            {
                SendDefMessage(Grobal2.SM_TAKEOFF_FAIL, n10, 0, 0, 0, "");
            }
        }

        /// <summary>
        /// 召唤强化卷,把招出的宝宝变成7级
        /// </summary>
        /// <returns></returns>
        public bool CallMobeItem()
        {
            bool result = false;
            TBaseObject Slave;
            if (this.m_SlaveList.Count == 0)
            {
                this.SysMsg("您没有召唤宝宝,不能使用此物品!", TMsgColor.c_Red, TMsgType.t_Hint);
                return result;
            }
            if (this.m_SlaveList.Count > 0)
            {
                for (int I = 0; I < this.m_SlaveList.Count; I++)
                {
                    Slave = this.m_SlaveList[I];
                    if (Slave.m_btRaceServer == Grobal2.RC_PLAYMOSTER) // 分身不能调级
                    {
                        continue;
                    }
                    if (Slave.m_btSlaveExpLevel < 7)
                    {
                        Slave.m_btSlaveExpLevel = 7;
                        Slave.RecalcAbilitys();//改变等级,刷新属性
                        Slave.RefNameColor();
                        Slave.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTLEVELUP, 0, 0, 0, "");// 宝宝升级动画 
                        result = true;
                        this.SysMsg("在神秘的力量影响下，您的宠物:" + Slave.m_sCharName + " 成长为7级", TMsgColor.BB_Fuchsia, TMsgType.t_Hint);
                        break;
                    }
                }
            }
            return result;
        }

        /// <summary>
        /// 全部修复,需要的持久值
        /// </summary>
        /// <returns></returns>
        public unsafe int RepairAllItemDura()
        {
            int result = 0;
            int nWhere;
            TStdItem* StdItem;
            for (nWhere = m_UseItems.GetLowerBound(0); nWhere <= m_UseItems.GetUpperBound(0); nWhere++)
            {
                if (this.m_UseItems[nWhere]->wIndex > 0)
                {
                    StdItem = UserEngine.GetStdItem(this.m_UseItems[nWhere]->wIndex);
                    if (StdItem != null)
                    {
                        if (((this.m_UseItems[nWhere]->DuraMax / 1000) > (this.m_UseItems[nWhere]->Dura / 1000)) && (StdItem->StdMode != 7) && (StdItem->StdMode != 25) && (StdItem->StdMode != 43)
                            && (StdItem->AniCount != 21))
                        {
                            if (this.CheckItemValue(this.m_UseItems[nWhere], 3)) // 禁止修
                            {
                                continue;
                            }
                            else if (this.PlugOfCheckCanItem(3, HUtil32.SBytePtrToString(StdItem->Name, 0, StdItem->NameLen), false, 0, 0))// 禁止物品规则(管理插件功能)
                            {
                                continue;
                            }
                            result += (this.m_UseItems[nWhere]->DuraMax - this.m_UseItems[nWhere]->Dura);
                        }
                    }
                }
            }
            return result;
        }

        /// <summary>
        /// 修复身上全部装备
        /// </summary>
        /// <param name="DureCount"></param>
        /// <param name="boDec"></param>
        public unsafe void RepairAllItem(int DureCount, bool boDec)
        {
            int nWhere;
            int RepCount;
            TStdItem* StdItem;
            for (nWhere = m_UseItems.GetLowerBound(0); nWhere <= m_UseItems.GetUpperBound(0); nWhere++)
            {
                if (this.m_UseItems[nWhere]->wIndex > 0)
                {
                    StdItem = UserEngine.GetStdItem(this.m_UseItems[nWhere]->wIndex);
                    if (StdItem != null)
                    {
                        if (((this.m_UseItems[nWhere]->DuraMax / 1000) > (this.m_UseItems[nWhere]->Dura / 1000)) && (StdItem->StdMode != 7) && (StdItem->StdMode != 25) && (StdItem->StdMode != 43) && (StdItem->AniCount != 21))
                        {
                            if (this.CheckItemValue(this.m_UseItems[nWhere], 3)) // 禁止修
                            {
                                continue;
                            }
                            else if (this.PlugOfCheckCanItem(3, HUtil32.SBytePtrToString(StdItem->Name, 0, StdItem->NameLen), false, 0, 0))// 禁止物品规则(管理插件功能)
                            {
                                continue;
                            }
                            if (!boDec)// 修复点够,则直接修复不计算
                            {
                                if ((this.m_UseItems[nWhere]->DuraMax / 1000) - (this.m_UseItems[nWhere]->Dura / 1000) > 0)
                                {
                                    this.SysMsg(HUtil32.SBytePtrToString(StdItem->Name, 0, StdItem->NameLen) + "修补成功。", TMsgColor.c_Green, TMsgType.t_Hint);
                                }
                                this.m_UseItems[nWhere]->Dura = this.m_UseItems[nWhere]->DuraMax;
                                this.SendMsg(this, Grobal2.RM_DURACHANGE, nWhere, this.m_UseItems[nWhere]->Dura, this.m_UseItems[nWhere]->DuraMax, 0, "");
                            }
                            else
                            {
                                RepCount = (this.m_UseItems[nWhere]->DuraMax / 1000) - (this.m_UseItems[nWhere]->Dura / 1000);
                                if (DureCount >= RepCount)
                                {
                                    DureCount -= RepCount;
                                    if ((this.m_UseItems[nWhere]->DuraMax / 1000) - (this.m_UseItems[nWhere]->Dura / 1000) > 0)
                                    {
                                        this.SysMsg(HUtil32.SBytePtrToString(StdItem->Name, 0, StdItem->NameLen) + "修补成功。", TMsgColor.c_Green, TMsgType.t_Hint);
                                    }
                                    this.m_UseItems[nWhere]->Dura = this.m_UseItems[nWhere]->DuraMax;
                                    this.SendMsg(this, Grobal2.RM_DURACHANGE, nWhere, this.m_UseItems[nWhere]->Dura, this.m_UseItems[nWhere]->DuraMax, 0, "");
                                }
                                else if (DureCount > 0)
                                {
                                    this.m_UseItems[nWhere]->Dura = Convert.ToUInt16(this.m_UseItems[nWhere]->Dura + DureCount * 1000);
                                    this.SendMsg(this, Grobal2.RM_DURACHANGE, nWhere, this.m_UseItems[nWhere]->Dura, this.m_UseItems[nWhere]->DuraMax, 0, "");
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }

        /// <summary>
        /// 随机移动
        /// </summary>
        public void RandomMove()
        {
            if (this.m_PEnvir == null)
            {
                return;
            }
            int nX = HUtil32.Random(this.m_PEnvir.m_nWidth);
            int nY = HUtil32.Random(this.m_PEnvir.m_nHeight);
            this.SendRefMsg(Grobal2.RM_SPACEMOVE_FIRE, 0, 0, 0, 0, "");
            this.SpaceMove(this.m_sMapName, nX, nY, 0);
        }

        /// <summary>
        /// 解包物品
        /// </summary>
        /// <param name="nShape"></param>
        /// <returns></returns>
        public unsafe string ClientUseItems_GetUnbindItemName(int nShape)
        {
            string result = "";
            TUnbindInfo* UnbindInfo;
            if (M2Share.g_UnbindList.Count > 0)
            {
                for (int I = 0; I < M2Share.g_UnbindList.Count; I++)
                {
                    UnbindInfo = (TUnbindInfo*)M2Share.g_UnbindList[I];
                    if (UnbindInfo->nUnbindCode == nShape)
                    {
                        result = HUtil32.SBytePtrToString(UnbindInfo->sItemName, UnbindInfo->sItemNameLen);
                        break;
                    }
                }
            }
            return result;
        }

        public unsafe bool ClientUseItems_GetUnBindItems(string sItemName, int nCount)
        {
            bool result = false;
            TUserItem* UserItem = null;
            if (nCount <= 0)
            {
                nCount = 1;
            }
            for (int I = 0; I < nCount; I++)
            {
                UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                if (UserEngine.CopyToUserItemFromName(sItemName, UserItem))
                {
                    this.m_ItemList.Add((IntPtr)UserItem);
                    if (this.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                    {
                        SendAddItem(UserItem);
                    }
                    result = true;
                }
                else
                {
                    Marshal.FreeHGlobal((IntPtr)UserItem);
                    break;
                }
            }
            return result;
        }

        public unsafe bool ClientUseItems_FoundUserItem(TUserItem* Item)
        {
            bool result = false;
            TUserItem* UserItem;
            if (this.m_ItemList.Count > 0)
            {
                for (int I = 0; I < this.m_ItemList.Count; I++)
                {
                    UserItem = (TUserItem*)this.m_ItemList[I];
                    if (UserItem == Item)
                    {
                        result = true;
                        break;
                    }
                }
            }
            return result;
        }

        /// <summary>
        /// 客户端使用物品
        /// </summary>
        /// <param name="nItemIdx"></param>
        /// <param name="sItemName"></param>
        private unsafe void ClientUseItems(int nItemIdx, string sItemName)
        {
            int ItemCount;
            bool boEatOK;
            bool boSendUpDate;
            TUserItem* UserItem = null;
            TStdItem* StdItem = null;
            TUserItem* UserItem34 = null;
            string sMapName = string.Empty;
            int nCurrX = 0;
            int nCurrY = 0;
            byte nCode = 0;
            UInt32 dwExp;
            m_boCanQueryBag = true;// 使用物品时,不能刷新包裹
            try
            {
                try
                {
                    boEatOK = false;
                    boSendUpDate = false;
                    StdItem = null;
                    if (m_boCanUseItem)// 能使用物品
                    {
                        if (!this.m_boDeath)
                        {
                            for (int I = this.m_ItemList.Count - 1; I >= 0; I--)
                            {
                                if (this.m_ItemList.Count <= 0)
                                {
                                    break;
                                }
                                UserItem = (TUserItem*)this.m_ItemList[I];
                                if (UserItem == null)
                                {
                                    continue;
                                }
                                if ((UserItem != null) && (UserItem->MakeIndex == nItemIdx))
                                {
                                    UserItem34 = UserItem;
                                    StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                                    if (StdItem != null)
                                    {
                                        if (!this.m_PEnvir.AllowStdItems(UserItem->wIndex))// 检查地图是否禁用此物品
                                        {
                                            this.SysMsg(string.Format(GameMsgDef.g_sCanotMapUseItemMsg, HUtil32.SBytePtrToString(StdItem->Name, StdItem->NameLen)), TMsgColor.c_Red, TMsgType.t_Hint);
                                            break;
                                        }
                                        switch (StdItem->StdMode)
                                        {
                                            case 0:
                                            case 1:
                                            case 3:// 药
                                                if (EatItems(StdItem))
                                                {
                                                    nCode = 1;
                                                    if (UserItem != null)
                                                    {
                                                        this.m_ItemList.RemoveAt(I);
                                                        Marshal.FreeHGlobal((IntPtr)UserItem);
                                                        UserItem = null;
                                                    }
                                                    boEatOK = true;
                                                }
                                                break;
                                            case 2:
                                                if (StdItem->AniCount == 21)  // 祝福罐 类型的物品 
                                                {
                                                    if (StdItem->Reserved != 56)
                                                    {
                                                        if (UserItem->Dura > 0)
                                                        {
                                                            if ((this.m_ItemList.Count - 1) <= Grobal2.MAXBAGITEM)
                                                            {
                                                                if (UserItem->Dura >= 1000)
                                                                {
                                                                    UserItem->Dura -= 1000; // 修改为1000
                                                                    UserItem->DuraMax -= 1000;// 减少存物品数量
                                                                    if (UserItem->DuraMax <= 0)
                                                                    {
                                                                        // 不能存取物品,则删除物品
                                                                        if (UserItem != null)
                                                                        {
                                                                            this.m_ItemList.RemoveAt(I);
                                                                            UserItem = null;
                                                                            boEatOK = true;
                                                                        }
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    UserItem->Dura = 0;
                                                                    UserItem->DuraMax = 0;//减少存物品数量
                                                                    if (UserItem->DuraMax <= 0)// 能存取物品,则删除物品
                                                                    {
                                                                        if (UserItem != null)
                                                                        {
                                                                            this.m_ItemList.RemoveAt(I);
                                                                            UserItem = null;
                                                                            boEatOK = true;
                                                                        }
                                                                    }
                                                                }
                                                                // 需要修改UnbindList.txt,加入 3 祝福油 3---为 祝福罐的外观值
                                                                ClientUseItems_GetUnBindItems(ClientUseItems_GetUnbindItemName(StdItem->Shape), 1);// 给一个祝福油 
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        // 泉水罐
                                                        if (UserItem->Dura >= 1000)
                                                        {
                                                            if ((this.m_ItemList.Count - 1) <= Grobal2.MAXBAGITEM)
                                                            {
                                                                if (UserItem->Dura >= 1000)
                                                                {
                                                                    UserItem->Dura -= 1000;
                                                                }
                                                                else
                                                                {
                                                                    UserItem->Dura = 0;
                                                                }
                                                                // 需要修改UnbindList.txt,加入 1 泉水   1---为 泉水的外观值
                                                                ClientUseItems_GetUnBindItems(ClientUseItems_GetUnbindItemName(StdItem->Shape), 1);// 给一个泉水
                                                            }
                                                        }
                                                    }
                                                    boSendUpDate = true;
                                                }
                                                else
                                                {
                                                    switch (StdItem->Shape)
                                                    {
                                                        case 0:// 计次物品
                                                            nCode = 3;
                                                            if ((StdItem->Source != 0) && (StdItem->Reserved != 0))// 捆绳类物品
                                                            {
                                                                if (UserItem != null)
                                                                {
                                                                    if (UserItem->Dura > 0)
                                                                    {
                                                                        if (CheckStdmodeFunItem(StdItem))
                                                                        {
                                                                            if (UserItem->Dura >= 1000)
                                                                            {
                                                                                UserItem->Dura -= 1000;
                                                                                boEatOK = true;
                                                                                nCode = 31;
                                                                                if (UserItem->Dura > 0)
                                                                                {
                                                                                    boSendUpDate = true;
                                                                                    boEatOK = false;
                                                                                }
                                                                                else
                                                                                {
                                                                                    if (UserItem != null)
                                                                                    {
                                                                                        UserItem->wIndex = 0;
                                                                                        nCode = 32;
                                                                                        this.m_ItemList.RemoveAt(I);
                                                                                        nCode = 33;
                                                                                        UserItem = null;
                                                                                    }
                                                                                }
                                                                            }
                                                                            else
                                                                            {
                                                                                UserItem->Dura = 0;
                                                                                if (UserItem != null)
                                                                                {
                                                                                    UserItem->wIndex = 0;
                                                                                    nCode = 34;
                                                                                    this.m_ItemList.RemoveAt(I);
                                                                                    nCode = 35;
                                                                                    UserItem = null;
                                                                                }
                                                                            }
                                                                            nCode = 36;
                                                                            UseStdmodeFunItem(StdItem);
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        UserItem->wIndex = 0;
                                                                    }
                                                                }
                                                            }
                                                            else
                                                            {
                                                                // 其它计次物品
                                                                if (UserItem != null)
                                                                {
                                                                    if (UserItem->Dura > 0)
                                                                    {
                                                                        if (UserItem->Dura >= 1000)
                                                                        {
                                                                            UserItem->Dura -= 1000;
                                                                            boEatOK = true;
                                                                            nCode = 37;
                                                                            if (UserItem->Dura > 0)
                                                                            {
                                                                                boSendUpDate = true;
                                                                                boEatOK = false;
                                                                            }
                                                                            else
                                                                            {
                                                                                if (UserItem != null)
                                                                                {
                                                                                    UserItem->wIndex = 0;
                                                                                    nCode = 38;
                                                                                    this.m_ItemList.RemoveAt(I);
                                                                                    nCode = 39;
                                                                                    UserItem = null;
                                                                                }
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            UserItem->Dura = 0;
                                                                            if (UserItem != null)
                                                                            {
                                                                                UserItem->wIndex = 0;
                                                                                nCode = 201;
                                                                                this.m_ItemList.RemoveAt(I);
                                                                                nCode = 202;
                                                                                UserItem = null;
                                                                            }
                                                                        }
                                                                        nCode = 203;
                                                                        UseStdmodeFunItem(StdItem);
                                                                    }
                                                                    else
                                                                    {
                                                                        UserItem->wIndex = 0;
                                                                    }
                                                                }
                                                            }
                                                            break;
                                                        case 1:// 召唤强化卷
                                                            nCode = 4;
                                                            if (UserItem->Dura > 0)
                                                            {
                                                                if (UserItem->Dura >= 1000)
                                                                {
                                                                    if (CallMobeItem())// 召唤强化卷,把招出的宝宝变成7级 
                                                                    {
                                                                        UserItem->Dura -= 1000;
                                                                        boEatOK = true;
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    UserItem->Dura = 0;
                                                                    UserItem->wIndex = 0;
                                                                }
                                                            }
                                                            if (UserItem->Dura > 0)
                                                            {
                                                                boSendUpDate = true;
                                                                boEatOK = false;
                                                            }
                                                            else
                                                            {
                                                                if (UserItem != null)
                                                                {
                                                                    this.m_ItemList.RemoveAt(I);
                                                                    UserItem = null;
                                                                }
                                                            }
                                                            break;
                                                        case 9://修复神水
                                                            nCode = 5;
                                                            ItemCount = RepairAllItemDura();
                                                            if ((UserItem->Dura > 0) && (ItemCount > 0))
                                                            {
                                                                if (UserItem->Dura >= (ItemCount / 10))
                                                                {
                                                                    UserItem->Dura -= (ushort)(ItemCount / 10);
                                                                    RepairAllItem(ItemCount / 1000, false);// 全部修复
                                                                    if (UserItem->Dura < 100)
                                                                    {
                                                                        UserItem->Dura = 0;
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    UserItem->Dura = 0;
                                                                    RepairAllItem(ItemCount / 1000, true);
                                                                }
                                                            }
                                                            boEatOK = false;
                                                            if (UserItem->Dura > 0)
                                                            {
                                                                boSendUpDate = true;
                                                            }
                                                            else
                                                            {
                                                                if (UserItem != null)
                                                                {
                                                                    this.m_ItemList.RemoveAt(I);
                                                                    UserItem = null;
                                                                }
                                                                boEatOK = true;
                                                            }
                                                            break;
                                                        case 2:// 随机传送石
                                                            nCode = 6;
                                                            if (!this.m_PEnvir.m_boNORANDOMMOVE)   // 地图没有禁止随机传送时才能使用
                                                            {
                                                                if (UserItem->Dura > 0)
                                                                {
                                                                    if (UserItem->Dura >= 1000)
                                                                    {
                                                                        UserItem->Dura -= 1000;
                                                                    }
                                                                    else
                                                                    {
                                                                        UserItem->Dura = 0;
                                                                        UserItem->wIndex = 0;
                                                                    }
                                                                    boEatOK = true;
                                                                    RandomMove();
                                                                }
                                                                if (UserItem->Dura > 0)
                                                                {
                                                                    boSendUpDate = true;
                                                                    boEatOK = false;
                                                                }
                                                                else
                                                                {
                                                                    if (UserItem != null)
                                                                    {
                                                                        this.m_ItemList.RemoveAt(I);
                                                                        Marshal.FreeHGlobal((IntPtr)UserItem);
                                                                    }
                                                                }
                                                            }
                                                            break;
                                                        case 3:
                                                            switch (StdItem->AniCount)// 双倍卷轴 双倍秘籍 双倍宝典 使用时,必进入这里,是脚本触发 ActionOfKillMonExpRate
                                                            {
                                                                case 15:
                                                                case 16:
                                                                case 17:
                                                                    nCode = 7;
                                                                    if (UserItem->Dura > 0)
                                                                    {
                                                                        if (UserItem->Dura >= 1000) // 100
                                                                        {
                                                                            UserItem->Dura -= 1000;// 100
                                                                        }
                                                                        else
                                                                        {
                                                                            UserItem->Dura = 0;
                                                                            UserItem->wIndex = 0;
                                                                        }
                                                                        m_nKillMonExpRate = m_nKillMonExpRate * 2;// 调整杀怪经验为双倍数
                                                                        m_nOldKillMonExpRate = m_nKillMonExpRate;
                                                                        m_dwKillMonExpRateTime = Convert.ToUInt16(m_dwKillMonExpRateTime + 180);// 经验倍数时间(秒)
                                                                        if (m_MyHero != null) // 英雄也同时双倍经验 
                                                                        {
                                                                            ((THeroObject)(m_MyHero)).m_nKillMonExpRate = ((THeroObject)(m_MyHero)).m_nKillMonExpRate * 2;
                                                                            ((THeroObject)(m_MyHero)).m_nOldKillMonExpRate = ((THeroObject)(m_MyHero)).m_nKillMonExpRate;
                                                                        }
                                                                        this.SysMsg(string.Format(GameMsgDef.g_sChangeKillMonExpRateMsg, m_nKillMonExpRate / 100, m_dwKillMonExpRateTime), TMsgColor.c_Green, TMsgType.t_Hint);
                                                                        boEatOK = true;
                                                                    }
                                                                    if (UserItem->Dura > 0)
                                                                    {
                                                                        boSendUpDate = true;
                                                                        boEatOK = false;
                                                                    }
                                                                    else
                                                                    {
                                                                        if (UserItem != null)
                                                                        {
                                                                            this.m_ItemList.RemoveAt(I);
                                                                            Marshal.FreeHGlobal((IntPtr)UserItem);
                                                                            UserItem = null;
                                                                        }
                                                                    }
                                                                    break;
                                                            }
                                                            break;
                                                    }
                                                }
                                                break;
                                            case 4:// 书
                                                nCode = 8;
                                                if (ReadBook(StdItem))
                                                {
                                                    if (UserItem != null)
                                                    {
                                                        this.m_ItemList.RemoveAt(I);
                                                        Marshal.FreeHGlobal((IntPtr)UserItem);
                                                        UserItem = null;
                                                    }
                                                    boEatOK = true;
                                                }
                                                break;
                                            case 7:// 使用次数  {数据库中没有分类是7的物品}
                                                nCode = 9;
                                                switch (StdItem->Shape)
                                                {
                                                    case 0:// 修复神水
                                                        if (UserItem->Dura > 0)
                                                        {
                                                            if (UserItem->Dura >= 1000)
                                                            {
                                                                UserItem->Dura -= 1000;
                                                            }
                                                            else
                                                            {
                                                                UserItem->Dura = 0;
                                                                UserItem->wIndex = 0;
                                                            }
                                                            boEatOK = true;
                                                        }
                                                        if (UserItem->Dura > 0)
                                                        {
                                                            boSendUpDate = true;
                                                            boEatOK = false;
                                                        }
                                                        else
                                                        {
                                                            if (UserItem != null)
                                                            {
                                                                this.m_ItemList.RemoveAt(I);
                                                                Marshal.FreeHGlobal((IntPtr)UserItem);
                                                            }
                                                        }
                                                        break;
                                                }
                                                break;
                                            case 31:// 解包物品
                                                nCode = 10;
                                                if (HUtil32.rangeInDefined(StdItem->AniCount, 0, 3))
                                                {
                                                    if ((this.m_ItemList.Count + 6 - 1) <= Grobal2.MAXBAGITEM)
                                                    {
                                                        if (UserItem != null)
                                                        {
                                                            this.m_ItemList.RemoveAt(I);
                                                            Marshal.FreeHGlobal((IntPtr)UserItem);
                                                        }
                                                        ClientUseItems_GetUnBindItems(ClientUseItems_GetUnbindItemName(StdItem->Shape), 6);
                                                        boEatOK = true;
                                                    }
                                                }
                                                if (HUtil32.rangeInDefined(StdItem->AniCount, 4, 255))
                                                {
                                                    switch (StdItem->Shape)
                                                    {
                                                        case 0:
                                                            if (ClientUseItems_FoundUserItem(UserItem))// 先查找物品，删除物品后再触发
                                                            {
                                                                if (UserItem != null)
                                                                {
                                                                    this.m_ItemList.RemoveAt(I);
                                                                    ClearCopyItem(0, UserItem->wIndex, UserItem->MakeIndex);// 清理复制品
                                                                    Marshal.FreeHGlobal((IntPtr)UserItem);
                                                                    UseStdmodeFunItem(StdItem);// 使用物品触发脚本段
                                                                }
                                                                boEatOK = true;
                                                            }
                                                            break;
                                                        case 1:
                                                            if (ItemDblClick(HUtil32.SBytePtrToString(StdItem->Name, StdItem->NameLen), UserItem->MakeIndex, ref sMapName, ref nCurrX, ref nCurrY))
                                                            {
                                                                if (UserItem != null)
                                                                {
                                                                    this.m_ItemList.RemoveAt(I);
                                                                    Marshal.FreeHGlobal((IntPtr)UserItem);
                                                                }
                                                                this.SpaceMove(sMapName, nCurrX, nCurrY, 0);
                                                                boEatOK = true;
                                                            }
                                                            else
                                                            {
                                                                this.SendMsg(M2Share.g_ManageNPC, Grobal2.RM_MENU_OK, 0, this.ToInt(), 0, 0,
                                                                      "当前地图坐标保存成功！！！\\再次双击，将传送到\\地图：" + this.m_sMapName + " 坐标：" + this.m_nCurrX + ":" + this.m_nCurrY);
                                                            }
                                                            break;
                                                    }
                                                }
                                                break;
                                            case 51:// 31 聚灵珠
                                                nCode = 11;
                                                if (StdItem->Shape == 0)
                                                {
                                                    if (UserItem->btValue[12] == 2)// 聚集满了经验，或是聚集时间到,才可使用
                                                    {
                                                        dwExp = Convert.ToUInt32(UserItem->Dura * 10000);
                                                        if (m_MyHero != null)
                                                        {
                                                            ((THeroObject)(m_MyHero)).GetExp((uint)Math.Abs(HUtil32.Round((double)(GameConfig.nHeroNoKillMonExpRate / 100) * dwExp)));
                                                            dwExp = (uint)Math.Abs(HUtil32.Round((double)((100 - GameConfig.nHeroNoKillMonExpRate) / 100) * dwExp));
                                                        }
                                                        if (this.m_Abil.Exp >= dwExp)
                                                        {
                                                            if ((int.MaxValue - this.m_Abil.Exp) < dwExp)
                                                            {
                                                                dwExp = int.MaxValue - this.m_Abil.Exp;
                                                            }
                                                        }
                                                        else
                                                        {
                                                            if ((int.MaxValue - dwExp) < this.m_Abil.Exp)
                                                            {
                                                                dwExp = int.MaxValue - dwExp;
                                                            }
                                                        }
                                                        m_GetExp = dwExp;// 人物取得的经验,$GetExp变量使用
                                                        if (M2Share.g_FunctionNPC != null)
                                                        {
                                                            M2Share.g_FunctionNPC.GotoLable(this, "@GetExp", false);// 取经验触发
                                                        }
                                                        this.m_Abil.Exp += dwExp;
                                                        this.SendMsg(this, Grobal2.RM_WINEXP, 0, (int)dwExp, 0, 0, "");
                                                        if (this.m_Abil.Exp >= this.m_Abil.MaxExp)
                                                        {
                                                            this.m_Abil.Exp -= this.m_Abil.MaxExp;
                                                            if ((this.m_Abil.Level < M2Share.MAXUPLEVEL) && (this.m_Abil.Level < GameConfig.nLimitExpLevel))
                                                            {
                                                                this.m_Abil.Level++; // 增加限制等级
                                                            }
                                                            if (this.m_Abil.Level < GameConfig.nLimitExpLevel)
                                                            {
                                                                this.HasLevelUp(this.m_Abil.Level - 1); // 增加限制等级
                                                            }
                                                            // 人物升级记录日志
                                                            M2Share.AddGameDataLog("12" + "\09" + this.m_sMapName + "\09" + (this.m_Abil.Level).ToString()
                                                                + "\09" + (this.m_Abil.Exp).ToString() + "/" + (this.m_Abil.MaxExp).ToString() + "\09"
                                                                + this.m_sCharName + "\09" + "0" + "\09" + "0" + "\09" + "1" + "\09" + "聚灵珠");
                                                        }
                                                        if (this.m_Magic68Skill != null)// 学过酒气护体
                                                        {
                                                            if (this.m_Magic68Skill->btLevel < 100)
                                                            {
                                                                m_Exp68 += (UInt16)dwExp;
                                                            }
                                                            if (m_Exp68 >= m_MaxExp68)// 超过升级经验,则升级技能
                                                            {
                                                                m_Exp68 -= m_MaxExp68;
                                                                if (this.m_Magic68Skill->btLevel < 100)
                                                                {
                                                                    this.m_Magic68Skill->btLevel++;
                                                                }
                                                                m_MaxExp68 = (UInt16)this.GetSkill68Exp(this.m_Magic68Skill->btLevel);
                                                                this.SendDelayMsg(this, Grobal2.RM_MAGIC_LVEXP, 0, this.m_Magic68Skill->MagicInfo.wMagicId,
                                                                    this.m_Magic68Skill->btLevel, this.m_Magic68Skill->nTranPoint, "", 100);
                                                            }
                                                            if (this.m_Magic68Skill->btLevel < 100)
                                                            {
                                                                // 发送酒气护体经验
                                                                this.SendMsg(this, Grobal2.RM_MAGIC68SKILLEXP, 0, 0, 0, 0, EncryptUnit.EncodeString(m_Exp68.ToString()) + "/" + m_MaxExp68.ToString());
                                                            }
                                                        }
                                                        if (UserItem != null)
                                                        {
                                                            this.m_ItemList.RemoveAt(I);
                                                            Marshal.FreeHGlobal((IntPtr)UserItem);
                                                        }
                                                        boEatOK = true;
                                                    }
                                                }
                                                break;
                                            case 60:// 51 饮酒
                                                nCode = 12;
                                                if ((StdItem->Shape != 0))// 除烧酒外
                                                {
                                                    if (!n_DrinkWineDrunk) // 没有喝醉
                                                    {
                                                        if (this.m_Abil.MaxAlcohol >= StdItem->Need)// 酒量值达到要求
                                                        {
                                                            if (UserItem->Dura > 0)
                                                            {
                                                                if (UserItem->Dura >= 1000)
                                                                {
                                                                    UserItem->Dura -= 1000;
                                                                }
                                                                else
                                                                {
                                                                    UserItem->Dura = 0;
                                                                }
                                                                this.SendRefMsg(Grobal2.RM_MYSHOW, 7, 0, 0, 0, "");// 喝酒自身动画 
                                                                if (this.m_Abil.WineDrinkValue == 0)// 如果醉酒度为0,则初始时间间隔
                                                                {
                                                                    m_dwDecWineDrinkValueTick = HUtil32.GetTickCount();
                                                                    m_dwAddAlcoholTick = HUtil32.GetTickCount();
                                                                }
                                                                this.m_Abil.WineDrinkValue += (ushort)(UserItem->btValue[1] * this.m_Abil.MaxAlcohol / 200);// 增加醉酒度
                                                                n_DrinkWineAlcohol = (byte)UserItem->btValue[1];// 饮酒时酒的度数
                                                                n_DrinkWineQuality = (byte)UserItem->btValue[0];// 饮酒时酒的品质
                                                                if (this.m_Abil.WineDrinkValue >= this.m_Abil.MaxAlcohol) // 醉酒度超过上限,即喝醉了
                                                                {
                                                                    this.m_Abil.WineDrinkValue = this.m_Abil.MaxAlcohol;
                                                                    this.n_DrinkWineDrunk = true;// 喝酒醉了
                                                                    this.SysMsg("自觉头晕不已,酒虽为情所系,奈何量去甚多,暂无余力再饮!", TMsgColor.c_Red, TMsgType.t_Hint);
                                                                    this.SendRefMsg(Grobal2.RM_MYSHOW, 9, 0, 0, 0, "");// 喝醉自身动画 
                                                                }
                                                                // 普通酒,品质2以上,25%机率加临时属性
                                                                if ((StdItem->AniCount == 1) && (n_DrinkWineQuality > 2) && (HUtil32.Random(4) == 0) && !n_DrinkWineDrunk)
                                                                {
                                                                    switch (HUtil32.Random(2))
                                                                    {
                                                                        case 0:// 增加防御力300秒
                                                                            this.DefenceUp(300);
                                                                            break;
                                                                        case 1:// 增加魔御300秒
                                                                            this.MagDefenceUp(300);
                                                                            break;
                                                                    }
                                                                }
                                                                if ((StdItem->AniCount == 2) && !n_DrinkWineDrunk)  // 药酒可增加药力值
                                                                {
                                                                    if (n_DrinkWineQuality > 4)// 品质为4以上,药酒增加临时属性
                                                                    {
                                                                        switch (StdItem->Shape)
                                                                        {
                                                                            case 8:
                                                                                switch (this.m_btJob)
                                                                                {
                                                                                    case 0:// 虎骨酒 增加攻击上限,魔法上限或道术上限2点,效果持续600秒
                                                                                        this.m_wStatusArrValue[0] = 2;
                                                                                        this.m_dwStatusArrTimeOutTick[0] = HUtil32.GetTickCount() + 600000; // 600 * 1000
                                                                                        break;
                                                                                    case 1:
                                                                                        this.m_wStatusArrValue[1] = 2;
                                                                                        this.m_dwStatusArrTimeOutTick[1] = HUtil32.GetTickCount() + 600000; // 600 * 1000
                                                                                        break;
                                                                                    case 2:
                                                                                        this.m_wStatusArrValue[2] = 2;
                                                                                        this.m_dwStatusArrTimeOutTick[2] = HUtil32.GetTickCount() + 600000; // 600 * 1000
                                                                                        break;
                                                                                }
                                                                                break;
                                                                            case 9:// 金箔酒  增加生命值上限100点,效果持续600秒
                                                                                this.m_wStatusArrValue[4] = 100;
                                                                                this.m_dwStatusArrTimeOutTick[4] = HUtil32.GetTickCount() + 600000;// 600 * 1000
                                                                                break;
                                                                            case 10:// 活脉酒  增加敏捷2点,效果持续600秒
                                                                                this.m_wStatusArrValue[11] = 2;
                                                                                this.m_dwStatusArrTimeOutTick[11] = HUtil32.GetTickCount() + 600000;// 600 * 1000
                                                                                break;
                                                                            case 11:// 玄参酒  增加防御上限4点,效果持续600秒
                                                                                this.m_wStatusTimeArr[9] = 4;
                                                                                this.m_dwStatusArrTimeOutTick[9] = HUtil32.GetTickCount() + 600000;// 600 * 1000
                                                                                break;
                                                                            case 12:// 蛇胆酒  增加魔法值上限200点,效果持续600秒
                                                                                this.m_wStatusArrValue[5] = 200;
                                                                                this.m_dwStatusArrTimeOutTick[5] = HUtil32.GetTickCount() + 600000; // 600 * 1000
                                                                                break;
                                                                        }
                                                                    }
                                                                    dw_UseMedicineTime = GameConfig.nDesMedicineTick;// 始化使用药酒时间(12小时)
                                                                    this.m_Abil.MedicineValue += (ushort)UserItem->btValue[2];// 增加药力值
                                                                    if (this.m_Abil.MedicineValue >= this.m_Abil.MaxMedicineValue) // 当前药力值达到当前等级上限时
                                                                    {
                                                                        this.m_Abil.MedicineValue -= this.m_Abil.MaxMedicineValue;
                                                                        switch ((n_MedicineLevel % 6))
                                                                        {
                                                                            case 0:// 增加永久属性
                                                                                switch (this.m_btJob)
                                                                                {
                                                                                    case 0:// 攻击/魔法/道术上限(看职业)
                                                                                        this.m_Abil.DC = HUtil32.MakeLong(this.m_Abil.DC, this.m_Abil.DC + 1);
                                                                                        break;
                                                                                    case 1:
                                                                                        this.m_Abil.MC = HUtil32.MakeLong(this.m_Abil.MC, this.m_Abil.MC + 1);
                                                                                        break;
                                                                                    case 2:
                                                                                        this.m_Abil.SC = HUtil32.MakeLong(this.m_Abil.SC, this.m_Abil.SC + 1);
                                                                                        break;
                                                                                }
                                                                                break;
                                                                            case 1:// 加魔御下限
                                                                                this.m_Abil.MAC = HUtil32.MakeLong(this.m_Abil.MAC + 1, this.m_Abil.MAC);
                                                                                break;
                                                                            case 2:// 加防御下限
                                                                                this.m_Abil.AC = HUtil32.MakeLong(this.m_Abil.AC + 1, this.m_Abil.AC);
                                                                                break;
                                                                            case 3:
                                                                                switch (this.m_btJob)
                                                                                {
                                                                                    case 0:// 攻击/魔法/道术下限(看职业)
                                                                                        this.m_Abil.DC = HUtil32.MakeLong(this.m_Abil.DC + 1, this.m_Abil.DC);
                                                                                        break;
                                                                                    case 1:
                                                                                        this.m_Abil.MC = HUtil32.MakeLong(this.m_Abil.MC + 1, this.m_Abil.MC);
                                                                                        break;
                                                                                    case 2:
                                                                                        this.m_Abil.SC = HUtil32.MakeLong(this.m_Abil.SC + 1, this.m_Abil.SC);
                                                                                        break;
                                                                                }
                                                                                break;
                                                                            case 4:  // 魔御上限
                                                                                this.m_Abil.MAC = HUtil32.MakeLong(this.m_Abil.MAC, this.m_Abil.MAC + 1);
                                                                                break;
                                                                            case 5: // 防御上限
                                                                                this.m_Abil.AC = HUtil32.MakeLong(this.m_Abil.AC, this.m_Abil.AC + 1);
                                                                                break;
                                                                        }
                                                                        if (n_MedicineLevel < M2Share.MAXUPLEVEL)
                                                                        {
                                                                            n_MedicineLevel++; // 增加等级
                                                                        }
                                                                        this.m_Abil.MaxMedicineValue = this.GetMedicineExp(n_MedicineLevel);// 取升级后的等级对应的药力值
                                                                        this.SysMsg("酒劲在周身弥漫,感觉身体状态有所改变", TMsgColor.c_Red, TMsgType.t_Hint);
                                                                    }
                                                                }
                                                                RecalcAbilitys();
                                                                this.CompareSuitItem(false);// 套装与身上装备对比
                                                                this.SendMsg(this, Grobal2.RM_ABILITY, 0, 0, 0, 0, "");
                                                                boEatOK = true;
                                                            }
                                                            if (UserItem->Dura > 0)
                                                            {
                                                                boSendUpDate = true;
                                                                boEatOK = false;
                                                            }
                                                            else
                                                            {
                                                                if (UserItem != null)
                                                                {
                                                                    UserItem->wIndex = 0;
                                                                    this.m_ItemList.RemoveAt(I);
                                                                    Marshal.FreeHGlobal((IntPtr)UserItem);
                                                                }
                                                            }
                                                        }
                                                        else
                                                        {
                                                            this.SysMsg("酒量需达到" + StdItem->Need + "才能饮用!", TMsgColor.c_Red, TMsgType.t_Hint);
                                                        }
                                                    }
                                                    else
                                                    {
                                                        this.SysMsg("自觉头晕不已,酒虽为情所系,奈何量去甚多,暂无余力再饮!", TMsgColor.c_Red, TMsgType.t_Hint);
                                                    }
                                                }
                                                break;
                                        }
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        this.SendMsg(M2Share.g_ManageNPC, Grobal2.RM_MENU_OK, 0, this.ToInt(), 0, 0, GameMsgDef.g_sCanotUseItemMsg);
                    }
                    if (boEatOK)
                    {
                        nCode = 13;
                        this.WeightChanged();
                        SendDefMessage(Grobal2.SM_EAT_OK, 0, 0, 0, 0, "");
                        if (StdItem->NeedIdentify == 1)
                        {
                            M2Share.AddGameDataLog("11" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString() + "\09" +
                                (this.m_nCurrY).ToString() + "\09" + this.m_sCharName + "\09" + HUtil32.SBytePtrToString(StdItem->Name, StdItem->NameLen) + "\09" + (UserItem34->MakeIndex).ToString() + "\09"
                                + "(" + (HUtil32.LoWord(StdItem->DC)).ToString() + "/" + (HUtil32.HiWord(StdItem->DC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MC)).ToString() + "/"
                                + (HUtil32.HiWord(StdItem->MC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->SC)).ToString() + "/" + (HUtil32.HiWord(StdItem->SC)).ToString() + ")" + "("
                                + (HUtil32.LoWord(StdItem->AC)).ToString() + "/" + (HUtil32.HiWord(StdItem->AC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MAC)).ToString() + "/"
                                + (HUtil32.HiWord(StdItem->MAC)).ToString() + ")" + (UserItem34->btValue[0]).ToString() + "/" + (UserItem34->btValue[1]).ToString() + "/"
                                + (UserItem34->btValue[2]).ToString() + "/" + (UserItem34->btValue[3]).ToString() + "/" + (UserItem34->btValue[4]).ToString()
                                + "/" + (UserItem34->btValue[5]).ToString() + "/" + (UserItem34->btValue[6]).ToString() + "/" + (UserItem34->btValue[7]).ToString()
                                + "/" + (UserItem34->btValue[8]).ToString() + "/" + (UserItem34->btValue[14]).ToString() + "\09" + "0");
                        }
                    }
                    else
                    {
                        nCode = 14;
                        SendDefMessage(Grobal2.SM_EAT_FAIL, 0, 0, 0, 0, "");
                    }
                    if ((UserItem != null) && boSendUpDate)
                    {
                        SendUpdateItem(UserItem);
                    }
                }
                catch
                {
                    M2Share.MainOutMessage("{异常} TPlayObject.ClientUseItems Code:" + nCode);
                }
            }
            finally
            {
                m_boCanQueryBag = false;
            }
        }

        private bool ItemDblClick(string sItemName, int nMakeIndex, ref string sMapName, ref int nCurrX, ref int nCurrY)
        {
            bool result;
            TItemEvent ItemEvent;
            result = false;
            sMapName = "";
            nCurrX = -1;
            nCurrY = -1;
            try
            {
                for (int I = M2Share.g_ItemDblClickList.Count - 1; I >= 0; I--)
                {
                    if (M2Share.g_ItemDblClickList.Count <= 0)
                    {
                        break;
                    }
                    ItemEvent = M2Share.g_ItemDblClickList[I];
                    if (ItemEvent.m_nMakeIndex == nMakeIndex)
                    {
                        sMapName = ItemEvent.m_sMapName;
                        nCurrX = ItemEvent.m_nCurrX;
                        nCurrY = ItemEvent.m_nCurrY;
                        M2Share.g_ItemDblClickList.RemoveAt(I);
                        Dispose(ItemEvent);
                        result = true;
                        break;
                    }
                }
                if (!result)
                {
                    ItemEvent = new TItemEvent();
                    ItemEvent.m_sItemName = sItemName;
                    ItemEvent.m_nMakeIndex = nMakeIndex;
                    ItemEvent.m_sMapName = this.m_sMapName;
                    ItemEvent.m_nCurrX = this.m_nCurrX;
                    ItemEvent.m_nCurrY = this.m_nCurrY;
                    M2Share.g_ItemDblClickList.Add(ItemEvent);
                }
            }
            finally
            {
            }
            M2Share.SaveItemDblClickList();
            return result;
        }

        /// <summary>
        /// 使用物品触发
        /// </summary>
        /// <param name="StdItem"></param>
        /// <returns></returns>
        private unsafe bool UseStdmodeFunItem(TStdItem* StdItem)
        {
            bool result = false;
            if (M2Share.g_FunctionNPC != null)
            {
                M2Share.g_FunctionNPC.GotoLable(this, "@StdModeFunc" + StdItem->AniCount, false);
                result = true;
            }
            return result;
        }

        /// <summary>
        /// 检查包裹是否有指定物品，是否达到指定数 药绳捆使用
        /// </summary>
        /// <param name="StdItem"></param>
        /// <returns></returns>
        private unsafe bool CheckStdmodeFunItem(TStdItem* StdItem)
        {
            bool result = false;
            int nCount;
            TUserItem* UserItem;
            TStdItem* StdItem1;
            try
            {
                nCount = 0;
                if (this.m_ItemList.Count > 0)
                {
                    for (int I = 0; I < this.m_ItemList.Count; I++)
                    {
                        UserItem = (TUserItem*)this.m_ItemList[I];
                        if (UserItem != null)
                        {
                            StdItem1 = UserEngine.GetStdItem(UserItem->wIndex);
                            if (StdItem1 != null)
                            {
                                if ((StdItem1->StdMode == 0) && (StdItem1->Source == StdItem->Source)) // 是药品，并与捆绳对应
                                {
                                    nCount++;
                                    if (nCount >= StdItem->Reserved)
                                    {
                                        result = true;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.CheckStdmodeFunItem");
            }
            return result;
        }

        /// <summary>
        /// 人物死亡触发
        /// </summary>
        /// <returns></returns>
        public bool DieFunc()
        {
            bool result = false;
            if (M2Share.g_FunctionNPC != null)
            {
                M2Share.g_FunctionNPC.GotoLable(this, "@PlayDie", false);
                result = true;
            }
            return result;
        }

        /// <summary>
        /// 人物学技能触发
        /// </summary>
        /// <param name="MagicID"></param>
        /// <returns></returns>
        public bool AddSkillFunc(int MagicID)
        {
            bool result = false;
            if (M2Share.g_FunctionNPC != null)
            {
                M2Share.g_FunctionNPC.GotoLable(this, "@HeroplaySkill" + MagicID, false);
                result = true;
            }
            return result;
        }

        /// <summary>
        /// 英雄学技能触发
        /// </summary>
        /// <param name="MagicID"></param>
        /// <returns></returns>
        public bool HeroAddSkillFunc(int MagicID)
        {
            bool result = false;
            if (M2Share.g_FunctionNPC != null)
            {
                M2Share.g_FunctionNPC.GotoLable(this, "@playSkill" + MagicID, false);
                result = true;
            }
            return result;
        }

        /// <summary>
        /// 宝宝杀死怪触发
        /// </summary>
        /// <returns></returns>
        public bool KillMissionMob()
        {
            bool result = false;
            if (M2Share.g_FunctionNPC != null)
            {
                M2Share.g_FunctionNPC.GotoLable(this, "@KillMissionMob", false);
                result = true;
            }
            return result;
        }

        /// <summary>
        /// 人物升级触发
        /// </summary>
        /// <returns></returns>
        public bool LevelUpFunc()
        {
            bool result = false;
            if (M2Share.g_FunctionNPC != null)
            {
                M2Share.g_FunctionNPC.GotoLable(this, "@PlayLevelUp", false);
                result = true;
            }
            return result;
        }

        /// <summary>
        /// 人物内功升级触发
        /// </summary>
        /// <returns></returns>
        public bool NGLevelUpFunc()
        {
            bool result = false;
            if (M2Share.g_FunctionNPC != null)
            {
                M2Share.g_FunctionNPC.GotoLable(this, "@PlayNGLevelUp", false);
                result = true;
            }
            return result;
        }

        /// <summary>
        /// 杀人触发
        /// </summary>
        /// <returns></returns>
        public bool KillPlayFunc()
        {
            bool result = false;
            try
            {
                if (M2Share.g_FunctionNPC != null)  // 地图杀人触发
                {
                    if (this.m_PEnvir != null)
                    {
                        if (this.m_PEnvir.m_boKILLFUNC)
                        {
                            M2Share.g_FunctionNPC.GotoLable(this, "@KillPlay" + this.m_PEnvir.m_nKILLFUNC, false);
                        }
                    }
                    M2Share.g_FunctionNPC.GotoLable(this, "@KillPlay", false);
                    result = true;
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.KillPlayFunc");
            }
            return result;
        }

        /// <summary>
        /// 客户端挖尸体东西
        /// </summary>
        /// <param name="BaseObject"></param>
        /// <param name="nX"></param>
        /// <param name="nY"></param>
        /// <param name="btDir"></param>
        /// <param name="dwDelayTime"></param>
        /// <returns></returns>
        private unsafe bool ClientGetButchItem(TBaseObject BaseObject, int nX, int nY, byte btDir, ref uint dwDelayTime)
        {
            bool result;
            int n10;
            int n14;
            uint dwCheckTime;
            bool Butch;
            int ButchChargeCount;
            int ButchChargeClass;
            TStdItem* StdItem;
            TUserItem* UserItem = null;
            string sCheckItemName;
            TMonItemInfo MonItem;
            byte nItemCount;// 进入触发段前的包裹物品数量
            ushort nLevel;// 进入触发段前的等级
            uint nExp;// 进入触发段前的经验
            int nGameDiamond;
            int nCreditPoint;
            int nGameGird;// 进入触发段前的金刚石,声望,灵符
            byte nCode; // 异常提示
            result = false;
            Butch = false;
            int K;
            if ((BaseObject == null) || (this.m_boGhost) || (this.m_boDeath))//人死后不能挖人形物品
            {
                return result;
            }
            if (BaseObject.m_boGhost)
            {
                return result;
            }
            if (HUtil32.GetTickCount() - BaseObject.m_dwDeathTick > (GameConfig.dwMakeGhostPlayMosterTime - 2000))//快要清理尸体时，则不再进入
            {
                return result;
            }
            nCode = 36;
            dwDelayTime = 0;
            nItemCount = 0;
            nLevel = 0;
            nExp = 0;
            nGameDiamond = 0;
            nCreditPoint = 0;
            nGameGird = 0;
            ButchChargeCount = 0;
            dwCheckTime = HUtil32.GetTickCount() - m_dwTurnTick;
            if (dwCheckTime < GameConfig.dwTurnIntervalTime)
            {
                dwDelayTime = GameConfig.dwTurnIntervalTime - dwCheckTime;
                return result;
            }
            m_dwTurnTick = HUtil32.GetTickCount();
            try
            {
                switch (BaseObject.m_btRaceServer)
                {
                    case 121:// 巨镰蜘蛛
                        ButchChargeClass = ((TGiantSickleSpiderATMonster)(BaseObject)).m_nButchChargeClass;
                        nCode = 42;
                        if (BaseObject.m_boDeath && (!BaseObject.m_boGhost) && (!BaseObject.m_boSkeleton) && (BaseObject.m_Master == null) && (BaseObject.m_btSlaveMakeLevel == 0))
                        {
                            nCode = 43;
                            ButchChargeCount = ((TGiantSickleSpiderATMonster)(BaseObject)).m_nButchChargeCount;
                            switch (ButchChargeClass)
                            {
                                case 0:// 挖取身上装备收费模式,并减少人物相应的数值 金币模式
                                    if (this.m_nGold >= ButchChargeCount)
                                    {
                                        Butch = true;
                                    }
                                    else
                                    {
                                        this.SysMsg("您的金币没有达到" + ButchChargeCount + ",将挖取不到任何物品!", TMsgColor.c_Red, TMsgType.t_Hint);
                                    }
                                    break;
                                case 1:// 元宝模式
                                    if (m_nGameGold >= ButchChargeCount)
                                    {
                                        Butch = true;
                                    }
                                    else
                                    {
                                        this.SysMsg("您的" + GameConfig.sGameGoldName + "没有达到" + ButchChargeCount + ",将挖取不到任何物品!", TMsgColor.c_Red, TMsgType.t_Hint);
                                    }
                                    break;
                                case 2:// 金刚石模式
                                    if (m_nGAMEDIAMOND >= ButchChargeCount)
                                    {
                                        Butch = true;
                                    }
                                    else
                                    {
                                        this.SysMsg("您的" + GameConfig.sGameDiaMond + "没有达到" + ButchChargeCount + ",将挖取不到任何物品!", TMsgColor.c_Red, TMsgType.t_Hint);
                                    }
                                    break;
                                case 3:// 灵符模式
                                    if (m_nGAMEGIRD >= ButchChargeCount)
                                    {
                                        Butch = true;
                                    }
                                    else
                                    {
                                        this.SysMsg("您的" + GameConfig.sGameGird + "没有达到" + ButchChargeCount + ",将挖取不到任何物品!", TMsgColor.c_Red, TMsgType.t_Hint);
                                    }
                                    break;
                            }
                            nCode = 44;
                            if (Butch)
                            {
                                switch (HUtil32.Random(3))
                                {
                                    case 0:// 挖所需的条件达到 随机处理挖 挖取列表中的物品
                                        nCode = 45;
                                        if ((BaseObject != null))
                                        {
                                            if (BaseObject.m_boGhost)
                                            {
                                                return result;
                                            }
                                            if (BaseObject.m_boButchSkeleton) // 正在被挖尸体
                                            {
                                                return result;
                                            }
                                            BaseObject.m_boButchSkeleton = true;
                                            try
                                            {
                                                for (int I = ((TGiantSickleSpiderATMonster)(BaseObject)).m_ButchItemList.Count - 1; I >= 0; I--)
                                                {
                                                    if (BaseObject.m_boGhost)
                                                    {
                                                        return result;
                                                    }
                                                    if (HUtil32.GetTickCount() - BaseObject.m_dwDeathTick > (GameConfig.dwMakeGhostPlayMosterTime - 2000)) // 如果快要清理尸体时，则不再进入
                                                    {
                                                        return result;
                                                    }
                                                    if (((TGiantSickleSpiderATMonster)BaseObject).m_ButchItemList.Count <= 0)
                                                    {
                                                        break;
                                                    }
                                                    MonItem = ((TMonItemInfo)(((TGiantSickleSpiderATMonster)(BaseObject)).m_ButchItemList[I]));
                                                    if ((MonItem.ItemName).ToLower().CompareTo((M2Share.sSTRING_GOLDNAME).ToLower()) == 0) // 如果是金币
                                                    {
                                                        nCode = 46;
                                                        this.m_nGold = this.m_nGold + MonItem.Count;
                                                        if (MonItem.Count > 0)
                                                        {
                                                            if (M2Share.g_boGameLogGold)
                                                            {
                                                                M2Share.AddGameDataLog("37" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString() + "\09"
                                                                    + (this.m_nCurrY).ToString() + "\09" + this.m_sCharName + "\09" + M2Share.sSTRING_GOLDNAME + "\09"
                                                                    + (MonItem.Count).ToString() + "\09" + "1" + "\09" + BaseObject.m_sCharName);
                                                            }
                                                        }
                                                        this.GoldChanged();
                                                        if (BaseObject != null)
                                                        {
                                                            ((TGiantSickleSpiderATMonster)BaseObject).m_ButchItemList.RemoveAt(I);
                                                        }
                                                        switch (ButchChargeClass)
                                                        {
                                                            case 0:// 挖到后,删除对应的物品 挖取到物品后减所需的条件的数量  金币模式
                                                                this.m_nGold -= ButchChargeCount;
                                                                this.GoldChanged();
                                                                break;
                                                            case 1:// 更新玩家的金币// 元宝模式
                                                                m_nGameGold -= ButchChargeCount;
                                                                this.GameGoldChanged();
                                                                break;
                                                            case 2:// 更新元宝数量 金刚石模式
                                                                m_nGAMEDIAMOND -= ButchChargeCount;
                                                                this.GameGoldChanged();
                                                                break;
                                                            case 3:// 更新金刚石数量 灵符模式
                                                                m_nGAMEGIRD -= ButchChargeCount;
                                                                this.GameGoldChanged();// 更新灵符数量
                                                                m_UseGameGird = ButchChargeCount;// 灵符使用计数
                                                                if (M2Share.g_FunctionNPC != null) // 灵符使用触发
                                                                {
                                                                    M2Share.g_FunctionNPC.GotoLable(this, "@USEGAMEGIRD", false);
                                                                }
                                                                break;
                                                        }
                                                        this.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTBUTCHMON, 0, 0, 0, "");// 挖尸体得到物品显示
                                                        break;
                                                    }
                                                    else
                                                    {
                                                        UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                                                        for (int i = 0; i < 22; i++)
                                                        {
                                                            UserItem->btValue[i] = 0;
                                                        }
                                                        if (UserEngine.CopyToUserItemFromName(MonItem.ItemName, UserItem))
                                                        {
                                                            nCode = 47;
                                                            UserItem->Dura = (ushort)HUtil32.Round((double)(UserItem->DuraMax / 100) * (20 + HUtil32.Random(80)));
                                                            if (HUtil32.Random(GameConfig.nPlayMonRandomAddValue) == 0)
                                                            {
                                                                UserEngine.RandomUpgradeItem(UserItem);
                                                            }
                                                            nCode = 48;
                                                            if ((UserItem != null))
                                                            {
                                                                nCode = 49;
                                                                switch (ButchChargeClass)
                                                                {
                                                                    case 0:// 挖取到物品后减所需的条件的数量 金币模式
                                                                        this.m_nGold -= ButchChargeCount;
                                                                        this.GoldChanged();
                                                                        break;
                                                                    case 1:// 更新玩家的金币 元宝模式
                                                                        m_nGameGold -= ButchChargeCount;
                                                                        this.GameGoldChanged();
                                                                        break;
                                                                    case 2:// 更新元宝数量 金刚石模式
                                                                        m_nGAMEDIAMOND -= ButchChargeCount;
                                                                        this.GameGoldChanged();
                                                                        break;
                                                                    case 3:// 更新金刚石数量 灵符模式
                                                                        m_nGAMEGIRD -= ButchChargeCount;
                                                                        this.GameGoldChanged();// 更新灵符数量 
                                                                        m_UseGameGird = ButchChargeCount;//灵符使用计数
                                                                        if (M2Share.g_FunctionNPC != null)
                                                                        {
                                                                            M2Share.g_FunctionNPC.GotoLable(this, "@USEGAMEGIRD", false);// 灵符使用触发
                                                                        }
                                                                        break;
                                                                }
                                                                nCode = 50;
                                                                if (BaseObject != null)
                                                                {
                                                                    ((TGiantSickleSpiderATMonster)(BaseObject)).m_ButchItemList.RemoveAt(I);// 挖到后,删除对应的物品
                                                                }
                                                                this.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTBUTCHMON, 0, 0, 0, "");// 挖尸体得到物品显示
                                                                sCheckItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                                                                this.PlugOfCheckCanItem(7, sCheckItemName, false, 0, 0);// 禁止物品规则(管理插件功能)
                                                                if (IsEnoughBag()) // 人物的包裹是否满了
                                                                {
                                                                    StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                                                                    if (this.IsAddWeightAvailable(StdItem->Weight)) // 人物的负重没有超过
                                                                    {
                                                                        if (StdItem->NeedIdentify == 1)
                                                                        {
                                                                            M2Share.AddGameDataLog("37" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString()
                                                                                + "\09" + (this.m_nCurrY).ToString() + "\09" + this.m_sCharName + "\09" + HUtil32.SBytePtrToString(StdItem->Name, 0, StdItem->NameLen)
                                                                                + "\09" + (UserItem->MakeIndex).ToString() + "\09" + "(" + (HUtil32.LoWord(StdItem->DC)).ToString()
                                                                                + "/" + (HUtil32.HiWord(StdItem->DC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MC)).ToString()
                                                                                + "/" + (HUtil32.HiWord(StdItem->MC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->SC)).ToString()
                                                                                + "/" + (HUtil32.HiWord(StdItem->SC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->AC)).ToString()
                                                                                + "/" + (HUtil32.HiWord(StdItem->AC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MAC)).ToString()
                                                                                + "/" + (HUtil32.HiWord(StdItem->MAC)).ToString() + ")" + (UserItem->btValue[0]).ToString() + "/"
                                                                                + (UserItem->btValue[1]).ToString() + "/" + (UserItem->btValue[2]).ToString() + "/"
                                                                                + (UserItem->btValue[3]).ToString() + "/" + (UserItem->btValue[4]).ToString() + "/"
                                                                                + (UserItem->btValue[5]).ToString() + "/" + (UserItem->btValue[6]).ToString() + "/"
                                                                                + (UserItem->btValue[7]).ToString() + "/" + (UserItem->btValue[8]).ToString() + "/"
                                                                                + (UserItem->btValue[14]).ToString() + "\09" + BaseObject.m_sCharName);
                                                                        }
                                                                        this.m_ItemList.Add((IntPtr)UserItem);
                                                                        nCode = 51;
                                                                        if (this.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                                                                        {
                                                                            nCode = 52;
                                                                            SendAddItem(UserItem);// 一次只给玩家一件物品
                                                                            SendUpdateItem(UserItem);// 更新物品
                                                                        }
                                                                        break;
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    nCode = 53;
                                                                    this.DropItemDown(UserItem, 3, false, false, this, this);// 一次只给玩家一件物品
                                                                    this.SysMsg(GameMsgDef.sButchEnoughBagHintMsg, TMsgColor.c_Red, TMsgType.t_Hint);// '您的包裹已没有办法装下任何物品!'
                                                                    break;
                                                                }
                                                            }
                                                        }
                                                        else
                                                        {
                                                            Marshal.FreeHGlobal((IntPtr)UserItem);
                                                        }
                                                    }
                                                }
                                            }
                                            finally
                                            {
                                                BaseObject.m_boButchSkeleton = false;
                                            }
                                        }
                                        break;
                                    case 1:
                                    case 2:// 0 进入触发段
                                        if (!IsEnoughBag())
                                        {
                                            this.SysMsg(GameMsgDef.sButchEnoughBagHintMsg, TMsgColor.c_Red, TMsgType.t_Hint);// '您的包裹已没有办法装下任何物品!'
                                        }
                                        if ((M2Share.g_FunctionNPC != null) && ((TGiantSickleSpiderATMonster)(BaseObject)).boIntoTrigger && IsEnoughBag())
                                        {
                                            if (M2Share.g_FunctionNPC.m_boGotoCount < 80) // 防止Goto数量过多,引起M2挂死
                                            {
                                                nItemCount = (byte)this.m_ItemList.Count;// 进入触发段前的包裹物品数量
                                                nLevel = this.m_Abil.Level;// 进入触发段前的等级
                                                nExp = this.m_Abil.Exp;// 进入触发段前的经验
                                                nGameDiamond = m_nGAMEDIAMOND;// 进入触发段前的金刚石
                                                nCreditPoint = m_btCreditPoint;// 进入触发段前的声望
                                                nGameGird = m_nGAMEGIRD;// 进入触发段前的灵符
                                                M2Share.g_FunctionNPC.GotoLable(this, "@ButchCloneItem" + BaseObject.m_sCharName, false);
                                                if ((nItemCount < this.m_ItemList.Count) || ((nExp < this.m_Abil.Exp) && (nLevel == this.m_Abil.Level)) ||
                                                    ((nExp > this.m_Abil.Exp) && (nLevel < this.m_Abil.Level)) || (nGameDiamond < m_nGAMEDIAMOND) || (nCreditPoint < m_btCreditPoint)
                                                    || (nGameGird < m_nGAMEGIRD))
                                                {
                                                    switch (ButchChargeClass)
                                                    {
                                                        case 0:// 挖取到物品后减所需的条件的数量 金币模式
                                                            this.m_nGold -= ButchChargeCount;
                                                            this.GoldChanged();
                                                            break;
                                                        case 1:// 更新玩家的金币 元宝模式
                                                            m_nGameGold -= ButchChargeCount;
                                                            this.GameGoldChanged();
                                                            break;
                                                        case 2:// 更新元宝数量 金刚石模式
                                                            m_nGAMEDIAMOND -= ButchChargeCount;
                                                            this.GameGoldChanged();
                                                            break;
                                                        case 3:// 更新金刚石数量 灵符模式
                                                            m_nGAMEGIRD -= ButchChargeCount;
                                                            this.GameGoldChanged();// 更新灵符数量
                                                            m_UseGameGird = ButchChargeCount;// 灵符使用计数
                                                            if (M2Share.g_FunctionNPC != null)
                                                            {
                                                                M2Share.g_FunctionNPC.GotoLable(this, "@USEGAMEGIRD", false);// 灵符使用触发
                                                            }
                                                            break;
                                                    }
                                                    this.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTBUTCHMON, 0, 0, 0, "");// 挖尸体得到物品显示
                                                }
                                            }
                                        }
                                        break;
                                }
                            }
                        }
                        break;
                    case 122:// 121 狂热火蜥蜴
                        ButchChargeClass = ((TSalamanderATMonster)(BaseObject)).m_nButchChargeClass;
                        nCode = 54;
                        if (BaseObject.m_boDeath && (!BaseObject.m_boGhost) && (!BaseObject.m_boSkeleton) && (BaseObject.m_Master == null) && (BaseObject.m_btSlaveMakeLevel == 0))
                        {
                            nCode = 55;
                            ButchChargeCount = ((TSalamanderATMonster)(BaseObject)).m_nButchChargeCount;
                            switch (ButchChargeClass)
                            {
                                case 0:// 挖取身上装备收费模式,并减少人物相应的数值 金币模式
                                    if (this.m_nGold >= ButchChargeCount)
                                    {
                                        Butch = true;
                                    }
                                    else
                                    {
                                        this.SysMsg("您的金币没有达到" + (ButchChargeCount).ToString() + ",将挖取不到任何物品!", TMsgColor.c_Red, TMsgType.t_Hint);
                                    }
                                    break;
                                case 1:// 元宝模式
                                    if (m_nGameGold >= ButchChargeCount)
                                    {
                                        Butch = true;
                                    }
                                    else
                                    {
                                        this.SysMsg("您的" + GameConfig.sGameGoldName + "没有达到" + (ButchChargeCount).ToString() + ",将挖取不到任何物品!", TMsgColor.c_Red, TMsgType.t_Hint);
                                    }
                                    break;
                                case 2:// 金刚石模式
                                    if (m_nGAMEDIAMOND >= ButchChargeCount)
                                    {
                                        Butch = true;
                                    }
                                    else
                                    {
                                        this.SysMsg("您的" + GameConfig.sGameDiaMond + "没有达到" + (ButchChargeCount).ToString() + ",将挖取不到任何物品!", TMsgColor.c_Red, TMsgType.t_Hint);
                                    }
                                    break;
                                case 3:// 灵符模式
                                    if (m_nGAMEGIRD >= ButchChargeCount)
                                    {
                                        Butch = true;
                                    }
                                    else
                                    {
                                        this.SysMsg("您的" + GameConfig.sGameGird + "没有达到" + (ButchChargeCount).ToString() + ",将挖取不到任何物品!", TMsgColor.c_Red, TMsgType.t_Hint);
                                    }
                                    break;
                            }
                            nCode = 56;
                            if (Butch)
                            {
                                switch (HUtil32.Random(3))
                                {
                                    case 0:
                                        // 挖所需的条件达到
                                        // 随机处理挖
                                        // 挖取列表中的物品
                                        nCode = 57;
                                        if ((BaseObject != null))
                                        {
                                            if (BaseObject.m_boGhost)
                                            {
                                                return result;
                                            }
                                            if (BaseObject.m_boButchSkeleton)// 正在被挖尸体
                                            {
                                                return result;
                                            }
                                            BaseObject.m_boButchSkeleton = true;
                                            try
                                            {
                                                for (int I = ((TSalamanderATMonster)(BaseObject)).m_ButchItemList.Count - 1; I >= 0; I--)
                                                {
                                                    if (BaseObject.m_boGhost)
                                                    {
                                                        return result;
                                                    }
                                                    if (HUtil32.GetTickCount() - BaseObject.m_dwDeathTick > (GameConfig.dwMakeGhostPlayMosterTime - 2000))
                                                    {
                                                        return result;// 如果快要清理尸体时，则不再进入
                                                    }
                                                    if (((TSalamanderATMonster)(BaseObject)).m_ButchItemList.Count <= 0)
                                                    {
                                                        break;
                                                    }
                                                    MonItem = ((TMonItemInfo)(((TSalamanderATMonster)(BaseObject)).m_ButchItemList[I]));
                                                    if ((MonItem.ItemName).ToLower().CompareTo((M2Share.sSTRING_GOLDNAME).ToLower()) == 0)// 如果是金币
                                                    {
                                                        nCode = 58;
                                                        this.m_nGold = this.m_nGold + MonItem.Count;
                                                        if (MonItem.Count > 0)
                                                        {
                                                            if (M2Share.g_boGameLogGold)
                                                            {
                                                                M2Share.AddGameDataLog("37" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString()
                                                                    + "\09" + (this.m_nCurrY).ToString() + "\09" + this.m_sCharName + "\09" + M2Share.sSTRING_GOLDNAME
                                                                    + "\09" + (MonItem.Count).ToString() + "\09" + "1" + "\09" + BaseObject.m_sCharName);
                                                            }
                                                        }
                                                        this.GoldChanged();
                                                        if (BaseObject != null)
                                                        {
                                                            ((TSalamanderATMonster)(BaseObject)).m_ButchItemList.RemoveAt(I);
                                                        }
                                                        switch (ButchChargeClass)
                                                        {
                                                            case 0:// 挖到后,删除对应的物品 挖取到物品后减所需的条件的数量 金币模式
                                                                this.m_nGold -= ButchChargeCount;
                                                                this.GoldChanged();
                                                                break;
                                                            case 1://更新玩家的金币// 元宝模式
                                                                m_nGameGold -= ButchChargeCount;
                                                                this.GameGoldChanged();
                                                                break;
                                                            case 2:// 更新元宝数量 金刚石模式
                                                                m_nGAMEDIAMOND -= ButchChargeCount;
                                                                this.GameGoldChanged();
                                                                break;
                                                            case 3:// 更新金刚石数量 灵符模式
                                                                m_nGAMEGIRD -= ButchChargeCount;
                                                                this.GameGoldChanged();// 更新灵符数量 
                                                                m_UseGameGird = ButchChargeCount;//灵符使用计数
                                                                if (M2Share.g_FunctionNPC != null)
                                                                {
                                                                    M2Share.g_FunctionNPC.GotoLable(this, "@USEGAMEGIRD", false); // 灵符使用触发
                                                                }
                                                                break;
                                                        }
                                                        this.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTBUTCHMON, 0, 0, 0, "");// 挖尸体得到物品显示
                                                        break;
                                                    }
                                                    else
                                                    {
                                                        UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                                                        if (UserEngine.CopyToUserItemFromName(MonItem.ItemName, UserItem))
                                                        {
                                                            nCode = 59;
                                                            UserItem->Dura = (ushort)HUtil32.Round((double)(UserItem->DuraMax / 100) * (20 + HUtil32.Random(80)));
                                                            if (HUtil32.Random(GameConfig.nPlayMonRandomAddValue) == 0)
                                                            {
                                                                UserEngine.RandomUpgradeItem(UserItem);
                                                            }
                                                            nCode = 60;
                                                            if ((UserItem != null))
                                                            {
                                                                nCode = 61;
                                                                switch (ButchChargeClass)
                                                                {
                                                                    case 0:// 挖取到物品后减所需的条件的数量// 金币模式
                                                                        this.m_nGold -= ButchChargeCount;
                                                                        this.GoldChanged();
                                                                        break;
                                                                    case 1:// 更新玩家的金币 元宝模式
                                                                        m_nGameGold -= ButchChargeCount;
                                                                        this.GameGoldChanged();
                                                                        break;
                                                                    case 2:// 更新元宝数量 金刚石模式
                                                                        m_nGAMEDIAMOND -= ButchChargeCount;
                                                                        this.GameGoldChanged();
                                                                        break;
                                                                    case 3:// 更新金刚石数量 灵符模式
                                                                        m_nGAMEGIRD -= ButchChargeCount;
                                                                        this.GameGoldChanged();// 更新灵符数量 
                                                                        m_UseGameGird = ButchChargeCount;//灵符使用计数
                                                                        if (M2Share.g_FunctionNPC != null)
                                                                        {
                                                                            M2Share.g_FunctionNPC.GotoLable(this, "@USEGAMEGIRD", false);// 灵符使用触发
                                                                        }
                                                                        break;
                                                                }
                                                                nCode = 62;
                                                                if (BaseObject != null)
                                                                {
                                                                    ((TSalamanderATMonster)(BaseObject)).m_ButchItemList.RemoveAt(I);// 挖到后,删除对应的物品
                                                                }
                                                                this.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTBUTCHMON, 0, 0, 0, "");// 挖尸体得到物品显示
                                                                sCheckItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                                                                this.PlugOfCheckCanItem(7, sCheckItemName, false, 0, 0);// 禁止物品规则(管理插件功能)
                                                                if (IsEnoughBag())  // 人物的包裹是否满了
                                                                {
                                                                    StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                                                                    if (this.IsAddWeightAvailable(StdItem->Weight))  // 人物的负重没有超过
                                                                    {
                                                                        if (StdItem->NeedIdentify == 1)
                                                                        {
                                                                            M2Share.AddGameDataLog("37" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString()
                                                                                + "\09" + (this.m_nCurrY).ToString() + "\09" + this.m_sCharName + "\09" + HUtil32.SBytePtrToString(StdItem->Name, 0, StdItem->NameLen)
                                                                                + "\09" + (UserItem->MakeIndex).ToString() + "\09" + "(" + (HUtil32.LoWord(StdItem->DC)).ToString()
                                                                                + "/" + (HUtil32.HiWord(StdItem->DC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MC)).ToString()
                                                                                + "/" + (HUtil32.HiWord(StdItem->MC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->SC)).ToString()
                                                                                + "/" + (HUtil32.HiWord(StdItem->SC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->AC)).ToString()
                                                                                + "/" + (HUtil32.HiWord(StdItem->AC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MAC)).ToString()
                                                                                + "/" + (HUtil32.HiWord(StdItem->MAC)).ToString() + ")" + (UserItem->btValue[0]).ToString() + "/"
                                                                                + (UserItem->btValue[1]).ToString() + "/" + (UserItem->btValue[2]).ToString() + "/"
                                                                                + (UserItem->btValue[3]).ToString() + "/" + (UserItem->btValue[4]).ToString() + "/"
                                                                                + (UserItem->btValue[5]).ToString() + "/" + (UserItem->btValue[6]).ToString() + "/"
                                                                                + (UserItem->btValue[7]).ToString() + "/" + (UserItem->btValue[8]).ToString() + "/"
                                                                                + (UserItem->btValue[14]).ToString() + "\09" + BaseObject.m_sCharName);
                                                                        }
                                                                        this.m_ItemList.Add((IntPtr)UserItem);
                                                                        nCode = 63;
                                                                        if (this.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                                                                        {
                                                                            nCode = 64;
                                                                            SendAddItem(UserItem); // 一次只给玩家一件物品
                                                                            SendUpdateItem(UserItem);// 更新物品
                                                                        }
                                                                        break;
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    nCode = 65;
                                                                    this.DropItemDown(UserItem, 3, false, false, this, this); // 一次只给玩家一件物品
                                                                    this.SysMsg(GameMsgDef.sButchEnoughBagHintMsg, TMsgColor.c_Red, TMsgType.t_Hint);// '您的包裹已没有办法装下任何物品!'
                                                                    break;
                                                                }
                                                            }
                                                        }
                                                        else
                                                        {
                                                            Marshal.FreeHGlobal((IntPtr)UserItem);
                                                        }
                                                    }
                                                }
                                            }
                                            finally
                                            {
                                                BaseObject.m_boButchSkeleton = false;
                                            }
                                        }
                                        break;
                                    case 1:
                                    case 2:// 进入触发段
                                        if (!IsEnoughBag())// '您的包裹已没有办法装下任何物品!'
                                        {
                                            this.SysMsg(GameMsgDef.sButchEnoughBagHintMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                                        }
                                        if ((M2Share.g_FunctionNPC != null) && ((TSalamanderATMonster)(BaseObject)).boIntoTrigger && IsEnoughBag())
                                        {
                                            if (M2Share.g_FunctionNPC.m_boGotoCount < 80)// 防止Goto数量过多,引起M2挂死
                                            {
                                                nItemCount = (byte)this.m_ItemList.Count;// 进入触发段前的包裹物品数量 
                                                nLevel = this.m_Abil.Level;// 进入触发段前的等级 
                                                nExp = this.m_Abil.Exp;// 进入触发段前的经验 
                                                nGameDiamond = m_nGAMEDIAMOND;// 进入触发段前的金刚石 
                                                nCreditPoint = m_btCreditPoint;// 进入触发段前的声望 
                                                nGameGird = m_nGAMEGIRD;// 进入触发段前的灵符 
                                                M2Share.g_FunctionNPC.GotoLable(this, "@ButchCloneItem" + BaseObject.m_sCharName, false);
                                                if ((nItemCount < this.m_ItemList.Count) || ((nExp < this.m_Abil.Exp) && (nLevel == this.m_Abil.Level)) || ((nExp > this.m_Abil.Exp) && (nLevel < this.m_Abil.Level)) || (nGameDiamond < m_nGAMEDIAMOND) || (nCreditPoint < m_btCreditPoint) || (nGameGird < m_nGAMEGIRD))
                                                {
                                                    switch (ButchChargeClass)
                                                    {
                                                        case 0:// 挖取到物品后减所需的条件的数量 金币模式
                                                            this.m_nGold -= ButchChargeCount;
                                                            this.GoldChanged();
                                                            break;
                                                        case 1:// 更新玩家的金币 元宝模式
                                                            m_nGameGold -= ButchChargeCount;
                                                            this.GameGoldChanged();
                                                            break;
                                                        case 2:// 更新元宝数量 金刚石模式
                                                            m_nGAMEDIAMOND -= ButchChargeCount;
                                                            this.GameGoldChanged();
                                                            break;
                                                        case 3:// 更新金刚石数量 灵符模式
                                                            m_nGAMEGIRD -= ButchChargeCount;
                                                            this.GameGoldChanged();// 更新灵符数量 
                                                            m_UseGameGird = ButchChargeCount;//灵符使用计数
                                                            if (M2Share.g_FunctionNPC != null)// 灵符使用触发
                                                            {
                                                                M2Share.g_FunctionNPC.GotoLable(this, "@USEGAMEGIRD", false);
                                                            }
                                                            break;
                                                    }
                                                    this.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTBUTCHMON, 0, 0, 0, "");// 挖尸体得到物品显示
                                                }
                                            }
                                        }
                                        break;
                                }
                            }
                        }
                        break;
                    case 123://122 圣殿卫士
                        ButchChargeClass = ((TTempleGuardian)(BaseObject)).m_nButchChargeClass;
                        nCode = 66;
                        if (BaseObject.m_boDeath && (!BaseObject.m_boGhost) && (!BaseObject.m_boSkeleton) && (BaseObject.m_Master == null) && (BaseObject.m_btSlaveMakeLevel == 0))
                        {
                            nCode = 67;
                            ButchChargeCount = ((TTempleGuardian)(BaseObject)).m_nButchChargeCount;
                            switch (ButchChargeClass)
                            {
                                case 0:// 挖取身上装备收费模式,并减少人物相应的数值// 金币模式
                                    if (this.m_nGold >= ButchChargeCount)
                                    {
                                        Butch = true;
                                    }
                                    else
                                    {
                                        this.SysMsg("您的金币没有达到" + (ButchChargeCount).ToString() + ",将挖取不到任何物品!", TMsgColor.c_Red, TMsgType.t_Hint);
                                    }
                                    break;
                                case 1:// 元宝模式
                                    if (m_nGameGold >= ButchChargeCount)
                                    {
                                        Butch = true;
                                    }
                                    else
                                    {
                                        this.SysMsg("您的" + GameConfig.sGameGoldName + "没有达到" + (ButchChargeCount).ToString() + ",将挖取不到任何物品!", TMsgColor.c_Red, TMsgType.t_Hint);
                                    }
                                    break;
                                case 2:// 金刚石模式
                                    if (m_nGAMEDIAMOND >= ButchChargeCount)
                                    {
                                        Butch = true;
                                    }
                                    else
                                    {
                                        this.SysMsg("您的" + GameConfig.sGameDiaMond + "没有达到" + (ButchChargeCount).ToString() + ",将挖取不到任何物品!", TMsgColor.c_Red, TMsgType.t_Hint);
                                    }
                                    break;
                                case 3:// 灵符模式
                                    if (m_nGAMEGIRD >= ButchChargeCount)
                                    {
                                        Butch = true;
                                    }
                                    else
                                    {
                                        this.SysMsg("您的" + GameConfig.sGameGird + "没有达到" + (ButchChargeCount).ToString() + ",将挖取不到任何物品!", TMsgColor.c_Red, TMsgType.t_Hint);
                                    }
                                    break;
                            }
                            nCode = 68;
                            if (Butch)
                            {
                                switch (HUtil32.Random(3))
                                {
                                    case 0:// 挖所需的条件达到 随机处理挖 挖取列表中的物品
                                        nCode = 69;
                                        if ((BaseObject != null))
                                        {
                                            if (BaseObject.m_boGhost)
                                            {
                                                return result;
                                            }
                                            if (BaseObject.m_boButchSkeleton)// 正在被挖尸体
                                            {
                                                return result;
                                            }
                                            BaseObject.m_boButchSkeleton = true;
                                            try
                                            {
                                                for (int I = ((TTempleGuardian)(BaseObject)).m_ButchItemList.Count - 1; I >= 0; I--)
                                                {
                                                    if (BaseObject.m_boGhost)
                                                    {
                                                        return result;
                                                    }
                                                    if (HUtil32.GetTickCount() - BaseObject.m_dwDeathTick > (GameConfig.dwMakeGhostPlayMosterTime - 2000))
                                                    {
                                                        return result;// 如果快要清理尸体时，则不再进入
                                                    }
                                                    if (((TTempleGuardian)(BaseObject)).m_ButchItemList.Count <= 0)
                                                    {
                                                        break;
                                                    }
                                                    MonItem = ((TMonItemInfo)(((TTempleGuardian)(BaseObject)).m_ButchItemList[I]));
                                                    if ((MonItem.ItemName).ToLower().CompareTo((M2Share.sSTRING_GOLDNAME).ToLower()) == 0) // 如果是金币
                                                    {
                                                        nCode = 70;
                                                        this.m_nGold = this.m_nGold + MonItem.Count;
                                                        if (MonItem.Count > 0)
                                                        {
                                                            if (M2Share.g_boGameLogGold)
                                                            {
                                                                M2Share.AddGameDataLog("37" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString()
                                                                    + "\09" + (this.m_nCurrY).ToString() + "\09" + this.m_sCharName + "\09" + M2Share.sSTRING_GOLDNAME
                                                                    + "\09" + (MonItem.Count).ToString() + "\09" + "1" + "\09" + BaseObject.m_sCharName);
                                                            }
                                                        }
                                                        this.GoldChanged();
                                                        if (BaseObject != null)
                                                        {
                                                            ((TTempleGuardian)(BaseObject)).m_ButchItemList.RemoveAt(I);
                                                        }
                                                        switch (ButchChargeClass)
                                                        {
                                                            case 0:// 挖到后,删除对应的物品 挖取到物品后减所需的条件的数量 金币模式
                                                                this.m_nGold -= ButchChargeCount;
                                                                this.GoldChanged();
                                                                break;
                                                            case 1:// 更新玩家的金币 元宝模式
                                                                m_nGameGold -= ButchChargeCount;
                                                                this.GameGoldChanged();
                                                                break;
                                                            case 2:// 更新元宝数量 金刚石模式
                                                                m_nGAMEDIAMOND -= ButchChargeCount;
                                                                this.GameGoldChanged();
                                                                break;
                                                            case 3:// 更新金刚石数量 灵符模式
                                                                m_nGAMEGIRD -= ButchChargeCount;
                                                                this.GameGoldChanged();// 更新灵符数量
                                                                m_UseGameGird = ButchChargeCount;// 灵符使用计数
                                                                if (M2Share.g_FunctionNPC != null)
                                                                {
                                                                    M2Share.g_FunctionNPC.GotoLable(this, "@USEGAMEGIRD", false); // 灵符使用触发 
                                                                }
                                                                break;
                                                        }
                                                        this.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTBUTCHMON, 0, 0, 0, "");// 挖尸体得到物品显示
                                                        break;
                                                    }
                                                    else
                                                    {
                                                        UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                                                        if (UserEngine.CopyToUserItemFromName(MonItem.ItemName, UserItem))
                                                        {
                                                            nCode = 71;
                                                            UserItem->Dura = (ushort)HUtil32.Round((double)(UserItem->DuraMax / 100) * (20 + HUtil32.Random(80)));
                                                            if (HUtil32.Random(GameConfig.nPlayMonRandomAddValue) == 0)
                                                            {
                                                                UserEngine.RandomUpgradeItem(UserItem);
                                                            }
                                                            nCode = 72;
                                                            if ((UserItem != null))
                                                            {
                                                                nCode = 73;
                                                                switch (ButchChargeClass)
                                                                {
                                                                    case 0:// 挖取到物品后减所需的条件的数量 金币模式
                                                                        this.m_nGold -= ButchChargeCount;
                                                                        this.GoldChanged();
                                                                        break;
                                                                    case 1://更新玩家的金币 元宝模式
                                                                        m_nGameGold -= ButchChargeCount;
                                                                        this.GameGoldChanged();
                                                                        break;
                                                                    case 2:// 更新元宝数量  金刚石模式
                                                                        m_nGAMEDIAMOND -= ButchChargeCount;
                                                                        this.GameGoldChanged();
                                                                        break;
                                                                    case 3:// 更新金刚石数量 灵符模式
                                                                        m_nGAMEGIRD -= ButchChargeCount;
                                                                        this.GameGoldChanged();// 更新灵符数量
                                                                        m_UseGameGird = ButchChargeCount;// 灵符使用计数
                                                                        if (M2Share.g_FunctionNPC != null)
                                                                        {
                                                                            // 灵符使用触发 20090108
                                                                            M2Share.g_FunctionNPC.GotoLable(this, "@USEGAMEGIRD", false);
                                                                        }
                                                                        break;
                                                                }
                                                                nCode = 74;
                                                                if (BaseObject != null)
                                                                {
                                                                    ((TTempleGuardian)(BaseObject)).m_ButchItemList.RemoveAt(I); // 挖到后,删除对应的物品
                                                                }
                                                                this.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTBUTCHMON, 0, 0, 0, "");// 挖尸体得到物品显示
                                                                sCheckItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                                                                this.PlugOfCheckCanItem(7, sCheckItemName, false, 0, 0);// 禁止物品规则(管理插件功能)
                                                                if (IsEnoughBag()) // 人物的包裹是否满了
                                                                {

                                                                    StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                                                                    if (this.IsAddWeightAvailable(StdItem->Weight))
                                                                    {
                                                                        // 人物的负重没有超过
                                                                        if (StdItem->NeedIdentify == 1)
                                                                        {
                                                                            M2Share.AddGameDataLog("37" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString() + "\09" + (this.m_nCurrY).ToString() + "\09" + this.m_sCharName + "\09" + HUtil32.SBytePtrToString(StdItem->Name, 0, StdItem->NameLen) + "\09" + (UserItem->MakeIndex).ToString() + "\09" + "(" + (HUtil32.LoWord(StdItem->DC)).ToString() + "/" + (HUtil32.HiWord(StdItem->DC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MC)).ToString() + "/" + (HUtil32.HiWord(StdItem->MC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->SC)).ToString() + "/" + (HUtil32.HiWord(StdItem->SC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->AC)).ToString() + "/" + (HUtil32.HiWord(StdItem->AC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MAC)).ToString() + "/" + (HUtil32.HiWord(StdItem->MAC)).ToString() + ")" + (UserItem->btValue[0]).ToString() + "/" + (UserItem->btValue[1]).ToString() + "/" + (UserItem->btValue[2]).ToString() + "/" + (UserItem->btValue[3]).ToString() + "/" + (UserItem->btValue[4]).ToString() + "/" + (UserItem->btValue[5]).ToString() + "/" + (UserItem->btValue[6]).ToString() + "/" + (UserItem->btValue[7]).ToString() + "/" + (UserItem->btValue[8]).ToString() + "/" + (UserItem->btValue[14]).ToString() + "\09" + BaseObject.m_sCharName);
                                                                        }
                                                                        this.m_ItemList.Add((IntPtr)UserItem);
                                                                        nCode = 75;
                                                                        if (this.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                                                                        {
                                                                            nCode = 76;
                                                                            SendAddItem(UserItem);
                                                                            SendUpdateItem(UserItem);
                                                                            // 更新物品
                                                                        }
                                                                        break;
                                                                        // 一次只给玩家一件物品 20080121
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    nCode = 77;
                                                                    this.DropItemDown(UserItem, 3, false, false, this, this);
                                                                    // 20080610
                                                                    // '您的包裹已没有办法装下任何物品!'
                                                                    this.SysMsg(GameMsgDef.sButchEnoughBagHintMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                                                                    break;
                                                                    // 一次只给玩家一件物品 20080121
                                                                }
                                                            }
                                                        }
                                                        else
                                                        {
                                                            //Dispose(UserItem);
                                                            UserItem = null;
                                                        }
                                                        // if CopyToUserItemFromName(MonItem.ItemName, UserItem) then begin
                                                    }
                                                    // if TTempleGuardian(BaseObject).m_ButchItemList.count = 0 then SysMsg(sYouFoundNothing {未发现任何物品！！！}, c_Red, t_Hint);
                                                }
                                                // for I := TTempleGuardian(BaseObject).m_ItemList.count-1 downto 0 do begin
                                            }
                                            finally
                                            {
                                                BaseObject.m_boButchSkeleton = false;
                                            }
                                        }
                                        break;
                                    case 1:
                                    case 2:
                                        // 0
                                        // 进入触发段
                                        if (!IsEnoughBag())
                                        {
                                            // '您的包裹已没有办法装下任何物品!'
                                            this.SysMsg(GameMsgDef.sButchEnoughBagHintMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                                        }
                                        if ((M2Share.g_FunctionNPC != null) && ((TTempleGuardian)(BaseObject)).boIntoTrigger && IsEnoughBag())
                                        {
                                            // 20080716
                                            if (M2Share.g_FunctionNPC.m_boGotoCount < 80)
                                            {
                                                // 防止Goto数量过多,引起M2挂死 20081004
                                                nItemCount = (byte)this.m_ItemList.Count;
                                                // 进入触发段前的包裹物品数量 20080925
                                                nLevel = this.m_Abil.Level;
                                                // 进入触发段前的等级 20081018
                                                nExp = this.m_Abil.Exp;
                                                // 进入触发段前的经验 20081018
                                                nGameDiamond = m_nGAMEDIAMOND;
                                                // 进入触发段前的金刚石 20081018
                                                nCreditPoint = m_btCreditPoint;
                                                // 进入触发段前的声望 20081018
                                                nGameGird = m_nGAMEGIRD;
                                                // 进入触发段前的灵符 20081018
                                                M2Share.g_FunctionNPC.GotoLable(this, "@ButchCloneItem" + BaseObject.m_sCharName, false);
                                                if ((nItemCount < this.m_ItemList.Count) || ((nExp < this.m_Abil.Exp) && (nLevel == this.m_Abil.Level)) || ((nExp > this.m_Abil.Exp) && (nLevel < this.m_Abil.Level)) || (nGameDiamond < m_nGAMEDIAMOND) || (nCreditPoint < m_btCreditPoint) || (nGameGird < m_nGAMEGIRD))
                                                {
                                                    switch (ButchChargeClass)
                                                    {
                                                        case 0:
                                                            // 挖取到物品后减所需的条件的数量 20080503
                                                            // 金币模式
                                                            this.m_nGold -= ButchChargeCount;
                                                            this.GoldChanged();
                                                            break;
                                                        case 1:
                                                            // 20080414 更新玩家的金币
                                                            // 元宝模式
                                                            m_nGameGold -= ButchChargeCount;
                                                            this.GameGoldChanged();
                                                            break;
                                                        case 2:
                                                            // 更新元宝数量  20080414
                                                            // 金刚石模式
                                                            m_nGAMEDIAMOND -= ButchChargeCount;
                                                            this.GameGoldChanged();
                                                            break;
                                                        case 3:// 更新金刚石数量  灵符模式
                                                            m_nGAMEGIRD -= ButchChargeCount;
                                                            this.GameGoldChanged();// 更新灵符数量
                                                            m_UseGameGird = ButchChargeCount;//灵符使用计数
                                                            if (M2Share.g_FunctionNPC != null)
                                                            {
                                                                M2Share.g_FunctionNPC.GotoLable(this, "@USEGAMEGIRD", false); // 灵符使用触发
                                                            }
                                                            break;
                                                    }
                                                    this.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTBUTCHMON, 0, 0, 0, "");// 挖尸体得到物品显示
                                                }
                                            }
                                        }
                                        break;
                                }
                            }
                        }
                        break;
                    case 124:// 金杖蜘蛛
                        ButchChargeClass = ((TheCrutchesSpider)(BaseObject)).m_nButchChargeClass;
                        nCode = 78;
                        if (BaseObject.m_boDeath && (!BaseObject.m_boGhost) && (!BaseObject.m_boSkeleton) && (BaseObject.m_Master == null) && (BaseObject.m_btSlaveMakeLevel == 0))
                        {
                            nCode = 79;
                            ButchChargeCount = ((TheCrutchesSpider)(BaseObject)).m_nButchChargeCount;
                            switch (ButchChargeClass)
                            {
                                case 0:// 挖取身上装备收费模式,并减少人物相应的数值 金币模式
                                    if (this.m_nGold >= ButchChargeCount)
                                    {
                                        Butch = true;
                                    }
                                    else
                                    {
                                        this.SysMsg("您的金币没有达到" + (ButchChargeCount).ToString() + ",将挖取不到任何物品!", TMsgColor.c_Red, TMsgType.t_Hint);
                                    }
                                    break;
                                case 1:// 元宝模式
                                    if (m_nGameGold >= ButchChargeCount)
                                    {
                                        Butch = true;
                                    }
                                    else
                                    {
                                        this.SysMsg("您的" + GameConfig.sGameGoldName + "没有达到" + (ButchChargeCount).ToString() + ",将挖取不到任何物品!", TMsgColor.c_Red, TMsgType.t_Hint);
                                    }
                                    break;
                                case 2:// 金刚石模式
                                    if (m_nGAMEDIAMOND >= ButchChargeCount)
                                    {
                                        Butch = true;
                                    }
                                    else
                                    {
                                        this.SysMsg("您的" + GameConfig.sGameDiaMond + "没有达到" + (ButchChargeCount).ToString() + ",将挖取不到任何物品!", TMsgColor.c_Red, TMsgType.t_Hint);
                                    }
                                    break;
                                case 3:// 灵符模式
                                    if (m_nGAMEGIRD >= ButchChargeCount)
                                    {
                                        Butch = true;
                                    }
                                    else
                                    {
                                        this.SysMsg("您的" + GameConfig.sGameGird + "没有达到" + (ButchChargeCount).ToString() + ",将挖取不到任何物品!", TMsgColor.c_Red, TMsgType.t_Hint);
                                    }
                                    break;
                            }
                            nCode = 80;
                            if (Butch)
                            {
                                switch (HUtil32.Random(3))
                                {
                                    case 0:// 挖所需的条件达到 随机处理挖 挖取列表中的物品
                                        nCode = 81;
                                        if ((BaseObject != null))
                                        {
                                            if (BaseObject.m_boGhost)
                                            {
                                                return result;
                                            }
                                            if (BaseObject.m_boButchSkeleton) // 正在被挖尸体
                                            {
                                                return result;
                                            }
                                            BaseObject.m_boButchSkeleton = true;
                                            try
                                            {
                                                for (int I = ((TheCrutchesSpider)(BaseObject)).m_ButchItemList.Count - 1; I >= 0; I--)
                                                {
                                                    if (BaseObject.m_boGhost)
                                                    {
                                                        return result;
                                                    }
                                                    if (HUtil32.GetTickCount() - BaseObject.m_dwDeathTick > (GameConfig.dwMakeGhostPlayMosterTime - 2000)) // 如果快要清理尸体时，则不再进入
                                                    {
                                                        return result;
                                                    }
                                                    if (((TheCrutchesSpider)(BaseObject)).m_ButchItemList.Count <= 0)
                                                    {
                                                        break;
                                                    }
                                                    MonItem = ((TMonItemInfo)(((TheCrutchesSpider)(BaseObject)).m_ButchItemList[I]));
                                                    if ((MonItem.ItemName).ToLower().CompareTo((M2Share.sSTRING_GOLDNAME).ToLower()) == 0)
                                                    {
                                                        // 如果是金币
                                                        nCode = 82;
                                                        this.m_nGold = this.m_nGold + MonItem.Count;
                                                        if (MonItem.Count > 0)
                                                        {
                                                            if (M2Share.g_boGameLogGold)
                                                            {
                                                                M2Share.AddGameDataLog("37" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString() + "\09" + (this.m_nCurrY).ToString() + "\09" + this.m_sCharName + "\09" + M2Share.sSTRING_GOLDNAME + "\09" + (MonItem.Count).ToString() + "\09" + "1" + "\09" + BaseObject.m_sCharName);
                                                            }
                                                        }
                                                        this.GoldChanged();
                                                        if (BaseObject != null)
                                                        {
                                                            ((TheCrutchesSpider)(BaseObject)).m_ButchItemList.RemoveAt(I);
                                                        }
                                                        switch (ButchChargeClass)
                                                        {
                                                            case 0:
                                                                // 挖到后,删除对应的物品
                                                                // 挖取到物品后减所需的条件的数量 20080503
                                                                // 金币模式
                                                                this.m_nGold -= ButchChargeCount;
                                                                this.GoldChanged();
                                                                break;
                                                            case 1:
                                                                // 20080414 更新玩家的金币
                                                                // 元宝模式
                                                                m_nGameGold -= ButchChargeCount;
                                                                this.GameGoldChanged();
                                                                break;
                                                            case 2:
                                                                // 更新元宝数量  20080414
                                                                // 金刚石模式
                                                                m_nGAMEDIAMOND -= ButchChargeCount;
                                                                this.GameGoldChanged();
                                                                break;
                                                            case 3:
                                                                // 更新金刚石数量 20080414
                                                                // 灵符模式
                                                                m_nGAMEGIRD -= ButchChargeCount;
                                                                this.GameGoldChanged();
                                                                // 更新灵符数量 20080414
                                                                m_UseGameGird = ButchChargeCount;
                                                                // 20090108 灵符使用计数
                                                                if (M2Share.g_FunctionNPC != null)
                                                                {
                                                                    // 灵符使用触发 20090108
                                                                    M2Share.g_FunctionNPC.GotoLable(this, "@USEGAMEGIRD", false);
                                                                }
                                                                break;
                                                        }
                                                        // Case
                                                        this.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTBUTCHMON, 0, 0, 0, "");
                                                        // 挖尸体得到物品显示
                                                        break;
                                                    }
                                                    else
                                                    {
                                                        UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                                                        if (UserEngine.CopyToUserItemFromName(MonItem.ItemName, UserItem))
                                                        {
                                                            nCode = 83;
                                                            //UserItem->Dura = Convert.ToUInt16(HUtil32.Round((UserItem->DuraMax / 100) * (20 + HUtil32.Random(80))));
                                                            if (HUtil32.Random(GameConfig.nPlayMonRandomAddValue) == 0)
                                                            {
                                                                UserEngine.RandomUpgradeItem(UserItem);
                                                            }
                                                            nCode = 84;
                                                            if ((UserItem != null))
                                                            {
                                                                nCode = 85;
                                                                switch (ButchChargeClass)
                                                                {
                                                                    case 0:
                                                                        // 挖取到物品后减所需的条件的数量 20080503
                                                                        // 金币模式
                                                                        this.m_nGold -= ButchChargeCount;
                                                                        this.GoldChanged();
                                                                        break;
                                                                    case 1:
                                                                        // 20080414 更新玩家的金币
                                                                        // 元宝模式
                                                                        m_nGameGold -= ButchChargeCount;
                                                                        this.GameGoldChanged();
                                                                        break;
                                                                    case 2:
                                                                        // 更新元宝数量  20080414
                                                                        // 金刚石模式
                                                                        m_nGAMEDIAMOND -= ButchChargeCount;
                                                                        this.GameGoldChanged();
                                                                        break;
                                                                    case 3:
                                                                        // 更新金刚石数量 20080414
                                                                        // 灵符模式
                                                                        m_nGAMEGIRD -= ButchChargeCount;
                                                                        this.GameGoldChanged();
                                                                        // 更新灵符数量 20080414
                                                                        m_UseGameGird = ButchChargeCount;
                                                                        // 20090108 灵符使用计数
                                                                        if (M2Share.g_FunctionNPC != null)
                                                                        {
                                                                            // 灵符使用触发 20090108
                                                                            M2Share.g_FunctionNPC.GotoLable(this, "@USEGAMEGIRD", false);
                                                                        }
                                                                        break;
                                                                }
                                                                // Case
                                                                nCode = 86;
                                                                if (BaseObject != null)
                                                                {
                                                                    ((TheCrutchesSpider)(BaseObject)).m_ButchItemList.RemoveAt(I);
                                                                }
                                                                // 挖到后,删除对应的物品
                                                                this.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTBUTCHMON, 0, 0, 0, "");
                                                                // 挖尸体得到物品显示 20080325
                                                                sCheckItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                                                                this.PlugOfCheckCanItem(7, sCheckItemName, false, 0, 0);
                                                                // 禁止物品规则(管理插件功能) 20080729
                                                                if (IsEnoughBag())
                                                                {
                                                                    // 人物的包裹是否满了 20080414
                                                                    StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                                                                    if (this.IsAddWeightAvailable(StdItem->Weight))
                                                                    {
                                                                        // 人物的负重没有超过
                                                                        if (StdItem->NeedIdentify == 1)
                                                                        {
                                                                            M2Share.AddGameDataLog("37" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString() + "\09" +
                                                                                (this.m_nCurrY).ToString() + "\09" + this.m_sCharName + "\09" + HUtil32.SBytePtrToString(StdItem->Name, 0, StdItem->NameLen) + "\09" + (UserItem->MakeIndex).ToString()
                                                                                + "\09" + "(" + (HUtil32.LoWord(StdItem->DC)).ToString() + "/" + (HUtil32.HiWord(StdItem->DC)).ToString() + ")" + "("
                                                                                + (HUtil32.LoWord(StdItem->MC)).ToString() + "/" + (HUtil32.HiWord(StdItem->MC)).ToString() + ")"
                                                                                + "(" + (HUtil32.LoWord(StdItem->SC)).ToString() + "/" + (HUtil32.HiWord(StdItem->SC)).ToString() + ")"
                                                                                + "(" + (HUtil32.LoWord(StdItem->AC)).ToString() + "/" + (HUtil32.HiWord(StdItem->AC)).ToString() + ")"
                                                                                + "(" + (HUtil32.LoWord(StdItem->MAC)).ToString() + "/" + (HUtil32.HiWord(StdItem->MAC)).ToString() + ")"
                                                                                + (UserItem->btValue[0]).ToString() + "/" + (UserItem->btValue[1]).ToString() + "/" + (UserItem->btValue[2]).ToString()
                                                                                + "/" + (UserItem->btValue[3]).ToString() + "/" + (UserItem->btValue[4]).ToString() + "/" + (UserItem->btValue[5]).ToString()
                                                                                + "/" + (UserItem->btValue[6]).ToString() + "/" + (UserItem->btValue[7]).ToString() + "/" + (UserItem->btValue[8]).ToString()
                                                                                + "/" + (UserItem->btValue[14]).ToString() + "\09" + BaseObject.m_sCharName);
                                                                        }
                                                                        this.m_ItemList.Add((IntPtr)UserItem);
                                                                        nCode = 87;
                                                                        if (this.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                                                                        {
                                                                            nCode = 88;
                                                                            SendAddItem(UserItem);
                                                                            SendUpdateItem(UserItem);
                                                                            // 更新物品
                                                                        }
                                                                        break;
                                                                        // 一次只给玩家一件物品 20080121
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    nCode = 89;
                                                                    this.DropItemDown(UserItem, 3, false, false, this, this);
                                                                    // 20080610
                                                                    // '您的包裹已没有办法装下任何物品!'
                                                                    this.SysMsg(GameMsgDef.sButchEnoughBagHintMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                                                                    break;
                                                                    // 一次只给玩家一件物品 20080121
                                                                }
                                                            }
                                                        }
                                                        else
                                                        {
                                                            //Dispose(UserItem);
                                                            UserItem = null;
                                                        }
                                                        // if CopyToUserItemFromName(MonItem.ItemName, UserItem) then begin
                                                    }
                                                    // if TheCrutchesSpider(BaseObject).m_ButchItemList.count = 0 then SysMsg(sYouFoundNothing {未发现任何物品！！！}, c_Red, t_Hint);
                                                }
                                                // for I := TheCrutchesSpider(BaseObject).m_ItemList.count-1 downto 0 do begin
                                            }
                                            finally
                                            {
                                                BaseObject.m_boButchSkeleton = false;
                                            }
                                        }
                                        break;
                                    case 1:
                                    case 2:
                                        // 0
                                        // 进入触发段
                                        if (!IsEnoughBag())
                                        {
                                            // '您的包裹已没有办法装下任何物品!'
                                            this.SysMsg(GameMsgDef.sButchEnoughBagHintMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                                        }

                                        if ((M2Share.g_FunctionNPC != null) && ((TheCrutchesSpider)(BaseObject)).boIntoTrigger && IsEnoughBag())
                                        {
                                            if (M2Share.g_FunctionNPC.m_boGotoCount < 80)// 防止Goto数量过多,引起M2挂死
                                            {
                                                nItemCount = (byte)this.m_ItemList.Count;// 进入触发段前的包裹物品数量 
                                                nLevel = this.m_Abil.Level;// 进入触发段前的等级 
                                                nExp = this.m_Abil.Exp;// 进入触发段前的经验 
                                                nGameDiamond = m_nGAMEDIAMOND;// 进入触发段前的金刚石 
                                                nCreditPoint = m_btCreditPoint;// 进入触发段前的声望 
                                                nGameGird = m_nGAMEGIRD;// 进入触发段前的灵符 
                                                M2Share.g_FunctionNPC.GotoLable(this, "@ButchCloneItem" + BaseObject.m_sCharName, false);
                                                if ((nItemCount < this.m_ItemList.Count) || ((nExp < this.m_Abil.Exp) && (nLevel == this.m_Abil.Level)) || ((nExp > this.m_Abil.Exp) && (nLevel < this.m_Abil.Level)) || (nGameDiamond < m_nGAMEDIAMOND) || (nCreditPoint < m_btCreditPoint) || (nGameGird < m_nGAMEGIRD))
                                                {
                                                    switch (ButchChargeClass)// 挖取到物品后减所需的条件的数量
                                                    {
                                                        case 0:// 金币模式
                                                            this.m_nGold -= ButchChargeCount;
                                                            this.GoldChanged();//  更新玩家的金币
                                                            break;
                                                        case 1:// 元宝模式
                                                            m_nGameGold -= ButchChargeCount;
                                                            this.GameGoldChanged();  // 更新元宝数量
                                                            break;
                                                        case 2:// 金刚石模式
                                                            m_nGAMEDIAMOND -= ButchChargeCount;
                                                            this.GameGoldChanged(); // 更新金刚石数量
                                                            break;
                                                        case 3:// 灵符模式
                                                            m_nGAMEGIRD -= ButchChargeCount;
                                                            this.GameGoldChanged();// 更新灵符数量
                                                            m_UseGameGird = ButchChargeCount;// 灵符使用计数
                                                            if (M2Share.g_FunctionNPC != null)
                                                            {
                                                                M2Share.g_FunctionNPC.GotoLable(this, "@USEGAMEGIRD", false);// 灵符使用触发
                                                            }
                                                            break;
                                                    }
                                                    this.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTBUTCHMON, 0, 0, 0, "");// 挖尸体得到物品显示
                                                }
                                            }
                                        }
                                        break;
                                }
                            }
                        }
                        break;
                    case 125:
                        // 124
                        // 雷炎蛛王
                        ButchChargeClass = ((TYanLeiWangSpider)(BaseObject)).m_nButchChargeClass;
                        nCode = 90;
                        // and (BaseObject.m_btSlaveExpLevel = 0)
                        if (BaseObject.m_boDeath && (!BaseObject.m_boGhost) && (!BaseObject.m_boSkeleton) && (BaseObject.m_Master == null) && (BaseObject.m_btSlaveMakeLevel == 0))
                        {
                            nCode = 91;
                            ButchChargeCount = ((TYanLeiWangSpider)(BaseObject)).m_nButchChargeCount;
                            switch (ButchChargeClass)// 挖取身上装备收费模式,并减少人物相应的数值
                            {
                                case 0:// 金币模式
                                    if (this.m_nGold >= ButchChargeCount)
                                    {
                                        Butch = true;
                                    }
                                    else
                                    {
                                        this.SysMsg("您的金币没有达到" + (ButchChargeCount).ToString() + ",将挖取不到任何物品!", TMsgColor.c_Red, TMsgType.t_Hint);
                                    }
                                    break;
                                case 1:// 元宝模式
                                    if (m_nGameGold >= ButchChargeCount)
                                    {
                                        Butch = true;
                                    }
                                    else
                                    {
                                        this.SysMsg("您的" + GameConfig.sGameGoldName + "没有达到" + (ButchChargeCount).ToString() + ",将挖取不到任何物品!", TMsgColor.c_Red, TMsgType.t_Hint);
                                    }
                                    break;
                                case 2:// 金刚石模式
                                    if (m_nGAMEDIAMOND >= ButchChargeCount)
                                    {
                                        Butch = true;
                                    }
                                    else
                                    {
                                        this.SysMsg("您的" + GameConfig.sGameDiaMond + "没有达到" + (ButchChargeCount).ToString() + ",将挖取不到任何物品!", TMsgColor.c_Red, TMsgType.t_Hint);
                                    }
                                    break;
                                case 3:// 灵符模式
                                    if (m_nGAMEGIRD >= ButchChargeCount)
                                    {
                                        Butch = true;
                                    }
                                    else
                                    {
                                        this.SysMsg("您的" + GameConfig.sGameGird + "没有达到" + ButchChargeCount + ",将挖取不到任何物品!", TMsgColor.c_Red, TMsgType.t_Hint);
                                    }
                                    break;
                            }
                            nCode = 80;
                            if (Butch)
                            {
                                switch (HUtil32.Random(3))// 挖所需的条件达到 随机处理挖
                                {
                                    case 0:// 挖取列表中的物品
                                        nCode = 92;
                                        if ((BaseObject != null))
                                        {
                                            if (BaseObject.m_boGhost)
                                            {
                                                return result;
                                            }
                                            if (BaseObject.m_boButchSkeleton) // 正在被挖尸体
                                            {
                                                return result;
                                            }
                                            BaseObject.m_boButchSkeleton = true;
                                            try
                                            {
                                                for (int I = ((TYanLeiWangSpider)(BaseObject)).m_ButchItemList.Count - 1; I >= 0; I--)
                                                {
                                                    if (BaseObject.m_boGhost)
                                                    {
                                                        return result;
                                                    }
                                                    if (HUtil32.GetTickCount() - BaseObject.m_dwDeathTick > (GameConfig.dwMakeGhostPlayMosterTime - 2000)) // 如果快要清理尸体时，则不再进入
                                                    {
                                                        return result;
                                                    }
                                                    if (((TYanLeiWangSpider)(BaseObject)).m_ButchItemList.Count <= 0)
                                                    {
                                                        break;
                                                    }
                                                    MonItem = ((TMonItemInfo)(((TYanLeiWangSpider)(BaseObject)).m_ButchItemList[I]));
                                                    if ((MonItem.ItemName).ToLower().CompareTo((M2Share.sSTRING_GOLDNAME).ToLower()) == 0)// 如果是金币
                                                    {
                                                        nCode = 94;
                                                        this.m_nGold = this.m_nGold + MonItem.Count;
                                                        if (MonItem.Count > 0)
                                                        {
                                                            if (M2Share.g_boGameLogGold)
                                                            {
                                                                M2Share.AddGameDataLog("37" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString() + "\09" 
                                                                    + (this.m_nCurrY).ToString() + "\09" + this.m_sCharName + "\09" + M2Share.sSTRING_GOLDNAME + "\09" 
                                                                    + (MonItem.Count).ToString() + "\09" + "1" + "\09" + BaseObject.m_sCharName);
                                                            }
                                                        }
                                                        this.GoldChanged();
                                                        if (BaseObject != null)
                                                        {
                                                            ((TYanLeiWangSpider)(BaseObject)).m_ButchItemList.RemoveAt(I);
                                                        }
                                                        switch (ButchChargeClass) // 挖到后,删除对应的物品 挖取到物品后减所需的条件的数量
                                                        {
                                                            case 0:// 金币模式
                                                                this.m_nGold -= ButchChargeCount;
                                                                this.GoldChanged();// 更新玩家的金币
                                                                break;
                                                            case 1:// 元宝模式
                                                                m_nGameGold -= ButchChargeCount;
                                                                this.GameGoldChanged();// 更新元宝数量
                                                                break;
                                                            case 2:// 金刚石模式
                                                                m_nGAMEDIAMOND -= ButchChargeCount;
                                                                this.GameGoldChanged();// 更新金刚石数量
                                                                break;
                                                            case 3:// 灵符模式
                                                                m_nGAMEGIRD -= ButchChargeCount;
                                                                this.GameGoldChanged();// 更新灵符数量
                                                                m_UseGameGird = ButchChargeCount;// 灵符使用计数
                                                                if (M2Share.g_FunctionNPC != null)
                                                                {
                                                                    M2Share.g_FunctionNPC.GotoLable(this, "@USEGAMEGIRD", false); // 灵符使用触发
                                                                }
                                                                break;
                                                        }
                                                        this.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTBUTCHMON, 0, 0, 0, "");// 挖尸体得到物品显示
                                                        break;
                                                    }
                                                    else
                                                    {
                                                        UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                                                        if (UserEngine.CopyToUserItemFromName(MonItem.ItemName, UserItem))
                                                        {
                                                            nCode = 95;
                                                            //UserItem->Dura = HUtil32.Round((UserItem->DuraMax / 100) * (20 + HUtil32.Random(80)));
                                                            if (HUtil32.Random(GameConfig.nPlayMonRandomAddValue) == 0)
                                                            {
                                                                UserEngine.RandomUpgradeItem(UserItem);
                                                            }
                                                            nCode = 96;
                                                            if ((UserItem != null))
                                                            {
                                                                nCode = 97;
                                                                switch (ButchChargeClass) // 挖取到物品后减所需的条件的数量
                                                                {
                                                                    case 0:// 金币模式
                                                                        this.m_nGold -= ButchChargeCount;
                                                                        this.GoldChanged();// 更新玩家的金币
                                                                        break;
                                                                    case 1:// 元宝模式
                                                                        m_nGameGold -= ButchChargeCount;
                                                                        this.GameGoldChanged(); // 更新元宝数量
                                                                        break;
                                                                    case 2:// 金刚石模式
                                                                        m_nGAMEDIAMOND -= ButchChargeCount;
                                                                        this.GameGoldChanged();// 更新金刚石数量
                                                                        break;
                                                                    case 3:// 灵符模式
                                                                        m_nGAMEGIRD -= ButchChargeCount;
                                                                        this.GameGoldChanged();// 更新灵符数量
                                                                        m_UseGameGird = ButchChargeCount;// 灵符使用计数
                                                                        if (M2Share.g_FunctionNPC != null)
                                                                        {
                                                                            M2Share.g_FunctionNPC.GotoLable(this, "@USEGAMEGIRD", false);// 灵符使用触发
                                                                        }
                                                                        break;
                                                                }
                                                                nCode = 98;
                                                                if (BaseObject != null)
                                                                {
                                                                    ((TYanLeiWangSpider)(BaseObject)).m_ButchItemList.RemoveAt(I);// 挖到后,删除对应的物品
                                                                }
                                                                this.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTBUTCHMON, 0, 0, 0, "");// 挖尸体得到物品显示
                                                                sCheckItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                                                                this.PlugOfCheckCanItem(7, sCheckItemName, false, 0, 0);// 禁止物品规则(管理插件功能)
                                                                if (IsEnoughBag()) // 人物的包裹是否满了
                                                                {
                                                                    StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                                                                    if (this.IsAddWeightAvailable(StdItem->Weight)) // 人物的负重没有超过
                                                                    {
                                                                        if (StdItem->NeedIdentify == 1)
                                                                        {
                                                                            M2Share.AddGameDataLog("37" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString() + "\09" + (this.m_nCurrY).ToString() + "\09" + this.m_sCharName + "\09" + HUtil32.SBytePtrToString(StdItem->Name, 0, StdItem->NameLen) + "\09" + (UserItem->MakeIndex).ToString() + "\09" + "(" + (HUtil32.LoWord(StdItem->DC)).ToString() + "/" + (HUtil32.HiWord(StdItem->DC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MC)).ToString() + "/" + (HUtil32.HiWord(StdItem->MC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->SC)).ToString() + "/" + (HUtil32.HiWord(StdItem->SC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->AC)).ToString() + "/" + (HUtil32.HiWord(StdItem->AC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MAC)).ToString() + "/" + (HUtil32.HiWord(StdItem->MAC)).ToString() + ")" + (UserItem->btValue[0]).ToString() + "/" + (UserItem->btValue[1]).ToString() + "/" + (UserItem->btValue[2]).ToString() + "/" + (UserItem->btValue[3]).ToString() + "/" + (UserItem->btValue[4]).ToString() + "/" + (UserItem->btValue[5]).ToString() + "/" + (UserItem->btValue[6]).ToString() + "/" + (UserItem->btValue[7]).ToString() + "/" + (UserItem->btValue[8]).ToString() + "/" + (UserItem->btValue[14]).ToString() + "\09" + BaseObject.m_sCharName);
                                                                        }
                                                                        this.m_ItemList.Add((IntPtr)UserItem);
                                                                        nCode = 99;
                                                                        if (this.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                                                                        {
                                                                            nCode = 100;
                                                                            SendAddItem(UserItem);
                                                                            SendUpdateItem(UserItem);// 更新物品
                                                                        }
                                                                        break;
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    nCode = 101;
                                                                    this.DropItemDown(UserItem, 3, false, false, this, this);// '您的包裹已没有办法装下任何物品!'
                                                                    this.SysMsg(GameMsgDef.sButchEnoughBagHintMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                                                                    break;
                                                                }
                                                            }
                                                        }
                                                        else
                                                        {
                                                            UserItem = null;
                                                        }
                                                    }
                                                }
                                            }
                                            finally
                                            {
                                                BaseObject.m_boButchSkeleton = false;
                                            }
                                        }
                                        break;
                                    case 1:
                                    case 2:// 进入触发段
                                        if (!IsEnoughBag()) // '您的包裹已没有办法装下任何物品!'
                                        {
                                            this.SysMsg(GameMsgDef.sButchEnoughBagHintMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                                        }
                                        if ((M2Share.g_FunctionNPC != null) && ((TYanLeiWangSpider)(BaseObject)).boIntoTrigger && IsEnoughBag())
                                        {
                                            if (M2Share.g_FunctionNPC.m_boGotoCount < 80)// 防止Goto数量过多,引起M2挂死
                                            {
                                                nItemCount = (byte)this.m_ItemList.Count;// 进入触发段前的包裹物品数量
                                                nLevel = this.m_Abil.Level;// 进入触发段前的等级 
                                                nExp = this.m_Abil.Exp;// 进入触发段前的经验 
                                                nGameDiamond = m_nGAMEDIAMOND;// 进入触发段前的金刚石 
                                                nCreditPoint = m_btCreditPoint;// 进入触发段前的声望 
                                                nGameGird = m_nGAMEGIRD;// 进入触发段前的灵符 
                                                M2Share.g_FunctionNPC.GotoLable(this, "@ButchCloneItem" + BaseObject.m_sCharName, false);
                                                if ((nItemCount < this.m_ItemList.Count) || ((nExp < this.m_Abil.Exp) && (nLevel == this.m_Abil.Level)) || ((nExp > this.m_Abil.Exp) 
                                                    && (nLevel < this.m_Abil.Level)) || (nGameDiamond < m_nGAMEDIAMOND) || (nCreditPoint < m_btCreditPoint) || (nGameGird < m_nGAMEGIRD))
                                                {
                                                    switch (ButchChargeClass) // 挖取到物品后减所需的条件的数量
                                                    {
                                                        case 0:// 金币模式
                                                            this.m_nGold -= ButchChargeCount;
                                                            this.GoldChanged(); // 更新玩家的金币
                                                            break;
                                                        case 1:// 元宝模式
                                                            m_nGameGold -= ButchChargeCount;
                                                            this.GameGoldChanged(); // 更新元宝数量 
                                                            break;
                                                        case 2:// 金刚石模式
                                                            m_nGAMEDIAMOND -= ButchChargeCount;
                                                            this.GameGoldChanged();  // 更新金刚石数量
                                                            break;
                                                        case 3:// 灵符模式
                                                            m_nGAMEGIRD -= ButchChargeCount;
                                                            this.GameGoldChanged();// 更新灵符数量 
                                                            m_UseGameGird = ButchChargeCount;// 灵符使用计数
                                                            if (M2Share.g_FunctionNPC != null)
                                                            {
                                                                M2Share.g_FunctionNPC.GotoLable(this, "@USEGAMEGIRD", false);// 灵符使用触发
                                                            }
                                                            break;
                                                    }
                                                    this.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTBUTCHMON, 0, 0, 0, "");// 挖尸体得到物品显示
                                                }
                                            }
                                        }
                                        break;
                                }
                            }
                        }
                        break;
                    case Grobal2.RC_PLAYMOSTER:// 人形怪
                        if ((HUtil32.GetTickCount() - ((TPlayMonster)(BaseObject)).m_nButchItemTime > 1000))// 人形怪
                        {
                            nCode = 1;
                            Butch = false;
                            ((TPlayMonster)(BaseObject)).m_nButchItemTime = HUtil32.GetTickCount();
                            ButchChargeClass = ((TPlayMonster)(BaseObject)).m_nButchChargeClass;
                            nCode = 2;// 如果目标是人形怪,已死亡且尸体存在,并且没有主人
                            if (BaseObject.m_boDeath && (!BaseObject.m_boGhost) && (!BaseObject.m_boSkeleton) && (BaseObject.m_Master == null) && (BaseObject.m_btSlaveMakeLevel == 0))
                            {
                                nCode = 3;
                                ButchChargeCount = ((TPlayMonster)(BaseObject)).m_nButchChargeCount;
                                switch (ButchChargeClass)// 挖取身上装备收费模式,并减少人物相应的数值
                                {
                                    case 0:// 金币模式
                                        if (this.m_nGold >= ButchChargeCount)
                                        {
                                            Butch = true;
                                        }
                                        else
                                        {
                                            this.SysMsg("您的金币没有达到" + (ButchChargeCount).ToString() + ",将挖取不到任何物品!", TMsgColor.c_Red, TMsgType.t_Hint);
                                        }
                                        break;
                                    case 1:// 元宝模式
                                        if (m_nGameGold >= ButchChargeCount)
                                        {
                                            Butch = true;
                                        }
                                        else
                                        {
                                            this.SysMsg("您的" + GameConfig.sGameGoldName + "没有达到" + (ButchChargeCount).ToString() + ",将挖取不到任何物品!", TMsgColor.c_Red, TMsgType.t_Hint);
                                        }
                                        break;
                                    case 2:// 金刚石模式
                                        if (m_nGAMEDIAMOND >= ButchChargeCount)
                                        {
                                            Butch = true;
                                        }
                                        else
                                        {
                                            this.SysMsg("您的" + GameConfig.sGameDiaMond + "没有达到" + (ButchChargeCount).ToString() + ",将挖取不到任何物品!", TMsgColor.c_Red, TMsgType.t_Hint);
                                        }
                                        break;
                                    case 3:// 灵符模式
                                        if (m_nGAMEGIRD >= ButchChargeCount)
                                        {
                                            Butch = true;
                                        }
                                        else
                                        {
                                            this.SysMsg("您的" + GameConfig.sGameGird + "没有达到" + (ButchChargeCount).ToString() + ",将挖取不到任何物品!", TMsgColor.c_Red, TMsgType.t_Hint);
                                        }
                                        break;
                                }
                                nCode = 4;
                                if (Butch)
                                {
                                    switch (HUtil32.Random(4))
                                    {
                                        case 0:
                                            nCode = 5;
                                            if (BaseObject != null)
                                            {
                                                nCode = 51;
                                                if (BaseObject.m_boGhost || (((TPlayMonster)(BaseObject)).m_ButchItemList == null))
                                                {
                                                    return result;
                                                }
                                                nCode = 52;
                                                if (BaseObject.m_boButchSkeleton) // 正在被挖尸体
                                                {
                                                    return result;
                                                }
                                                BaseObject.m_boButchSkeleton = true;
                                                try
                                                {
                                                    for (int I = ((TPlayMonster)(BaseObject)).m_ButchItemList.Count - 1; I >= 0; I--)
                                                    {
                                                        nCode = 53;
                                                        if (BaseObject.m_boGhost)
                                                        {
                                                            return result;
                                                        }
                                                        if (HUtil32.GetTickCount() - BaseObject.m_dwDeathTick > (GameConfig.dwMakeGhostPlayMosterTime - 2000)) // 如果快要清理尸体时，则不再进入
                                                        {
                                                            return result;
                                                        }
                                                        nCode = 54;
                                                        if (((TPlayMonster)(BaseObject)).m_ButchItemList.Count <= 0)
                                                        {
                                                            break;
                                                        }
                                                        nCode = 55;
                                                        MonItem = ((TMonItemInfo)(((TPlayMonster)(BaseObject)).m_ButchItemList[I]));
                                                        nCode = 103;
                                                        if ((MonItem.ItemName).ToLower().CompareTo((M2Share.sSTRING_GOLDNAME).ToLower()) == 0)// 如果是金币
                                                        {
                                                            this.m_nGold = this.m_nGold + MonItem.Count;
                                                            if (MonItem.Count > 0)
                                                            {
                                                                if (M2Share.g_boGameLogGold)
                                                                {
                                                                    M2Share.AddGameDataLog("37" + "\09" + this.m_sMapName + "\09" + this.m_nCurrX + "\09" + this.m_nCurrY +
                                                                        "\09" + this.m_sCharName + "\09" + M2Share.sSTRING_GOLDNAME + "\09" + MonItem.Count + "\09" + "1"
                                                                        + "\09" + BaseObject.m_sCharName);
                                                                }
                                                            }
                                                            this.GoldChanged();
                                                            ((TPlayMonster)(BaseObject)).m_ButchItemList.RemoveAt(I);
                                                            switch (ButchChargeClass)
                                                            {
                                                                case 0:// 挖取到物品后减所需的条件的数量 
                                                                    this.m_nGold -= ButchChargeCount;
                                                                    this.GoldChanged();
                                                                    break;
                                                                case 1:// 更新玩家的金币
                                                                    m_nGameGold -= ButchChargeCount;
                                                                    this.GameGoldChanged();
                                                                    break;
                                                                case 2:// 更新元宝数量
                                                                    m_nGAMEDIAMOND -= ButchChargeCount;
                                                                    this.GameGoldChanged();
                                                                    break;
                                                                case 3:// 更新金刚石数量
                                                                    m_nGAMEGIRD -= ButchChargeCount;
                                                                    this.GameGoldChanged();// 更新灵符数量
                                                                    m_UseGameGird = ButchChargeCount;// 灵符使用计数
                                                                    if (M2Share.g_FunctionNPC != null)  // 灵符使用触发
                                                                    {
                                                                        M2Share.g_FunctionNPC.GotoLable(this, "@USEGAMEGIRD", false);
                                                                    }
                                                                    break;
                                                            }
                                                            this.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTBUTCHMON, 0, 0, 0, "");// 挖尸体得到物品显示
                                                            break;
                                                        }
                                                        else
                                                        {
                                                            UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                                                            if (UserEngine.CopyToUserItemFromName(MonItem.ItemName, UserItem))
                                                            {
                                                                nCode = 7;
                                                                UserItem->Dura = (ushort)HUtil32.Round((double)(UserItem->DuraMax / 100) * (20 + HUtil32.Random(80)));
                                                                if (HUtil32.Random(GameConfig.nPlayMonRandomAddValue) == 0)
                                                                {
                                                                    UserEngine.RandomUpgradeItem(UserItem);
                                                                }
                                                                nCode = 8;
                                                                if ((UserItem != null))
                                                                {
                                                                    nCode = 9;
                                                                    switch (ButchChargeClass)
                                                                    {
                                                                        case 0:// 金币模式
                                                                            this.m_nGold -= ButchChargeCount;
                                                                            this.GoldChanged();
                                                                            break;
                                                                        case 1:// 元宝模式
                                                                            m_nGameGold -= ButchChargeCount;
                                                                            this.GameGoldChanged();
                                                                            break;
                                                                        case 2:// 金刚石模式
                                                                            m_nGAMEDIAMOND -= ButchChargeCount;
                                                                            this.GameGoldChanged();
                                                                            break;
                                                                        case 3:// 灵符模式
                                                                            m_nGAMEGIRD -= ButchChargeCount;
                                                                            this.GameGoldChanged();// 更新灵符数量
                                                                            m_UseGameGird = ButchChargeCount;// 灵符使用计数
                                                                            if (M2Share.g_FunctionNPC != null)  // 灵符使用触发
                                                                            {
                                                                                M2Share.g_FunctionNPC.GotoLable(this, "@USEGAMEGIRD", false);
                                                                            }
                                                                            break;
                                                                    }
                                                                    nCode = 10;
                                                                    if (BaseObject != null)
                                                                    {
                                                                        ((TPlayMonster)(BaseObject)).m_ButchItemList.RemoveAt(I);// 挖到后,删除对应的物品
                                                                    }
                                                                    this.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTBUTCHMON, 0, 0, 0, "");// 人物挖尸体得到物品显示
                                                                    sCheckItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                                                                    this.PlugOfCheckCanItem(7, sCheckItemName, false, 0, 0);// 禁止物品规则(管理插件功能)
                                                                    if (IsEnoughBag()) // 人物的包裹是否满了
                                                                    {
                                                                        StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                                                                        if (this.IsAddWeightAvailable(StdItem->Weight)) // 人物的负重没有超过
                                                                        {
                                                                            if (StdItem->NeedIdentify == 1)
                                                                            {
                                                                                M2Share.AddGameDataLog("37" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString()
                                                                                    + "\09" + (this.m_nCurrY).ToString() + "\09" + this.m_sCharName + "\09" + HUtil32.SBytePtrToString(StdItem->Name, 0, StdItem->NameLen)
                                                                                    + "\09" + (UserItem->MakeIndex).ToString() + "\09" + "(" + (HUtil32.LoWord(StdItem->DC)).ToString()
                                                                                    + "/" + (HUtil32.HiWord(StdItem->DC)).ToString() + ")" + "(" +
                                                                                    (HUtil32.LoWord(StdItem->MC)).ToString() + "/" + (HUtil32.HiWord(StdItem->MC)).ToString() + ")"
                                                                                    + "(" + (HUtil32.LoWord(StdItem->SC)).ToString() + "/" + (HUtil32.HiWord(StdItem->SC)).ToString()
                                                                                    + ")" + "(" + (HUtil32.LoWord(StdItem->AC)).ToString() + "/" +
                                                                                    (HUtil32.HiWord(StdItem->AC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MAC)).ToString() +
                                                                                    "/" + (HUtil32.HiWord(StdItem->MAC)).ToString() + ")" + (UserItem->btValue[0]).ToString() + "/"
                                                                                    + (UserItem->btValue[1]).ToString() + "/" + (UserItem->btValue[2]).ToString() + "/" +
                                                                                    (UserItem->btValue[3]).ToString() + "/" + (UserItem->btValue[4]).ToString() + "/" +
                                                                                    (UserItem->btValue[5]).ToString() + "/" + (UserItem->btValue[6]).ToString() + "/" +
                                                                                    (UserItem->btValue[7]).ToString() + "/" + (UserItem->btValue[8]).ToString() + "/" +
                                                                                    (UserItem->btValue[14]).ToString() + "\09" + BaseObject.m_sCharName);
                                                                            }
                                                                            this.m_ItemList.Add((IntPtr)UserItem);
                                                                            nCode = 11;
                                                                            if (this.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                                                                            {
                                                                                nCode = 12;
                                                                                SendAddItem(UserItem); // 一次只给玩家一件物品 20080121
                                                                                SendUpdateItem(UserItem);// 更新物品
                                                                            }
                                                                            break;
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        nCode = 13;
                                                                        this.DropItemDown(UserItem, 3, false, false, this, this);  // 一次只给玩家一件物品 20080121
                                                                        this.SysMsg(GameMsgDef.sButchEnoughBagHintMsg, TMsgColor.c_Red, TMsgType.t_Hint); // '您的包裹已没有办法装下任何物品!'
                                                                        break;
                                                                    }
                                                                }
                                                            }
                                                            else
                                                            {
                                                                UserItem = null;
                                                            }
                                                        }
                                                    }
                                                }
                                                finally
                                                {
                                                    BaseObject.m_boButchSkeleton = false;
                                                }
                                            }
                                            break;
                                        case 1:// 0 挖身上装备
                                            nCode = 15;
                                            if ((BaseObject != null))
                                            {
                                                if (((TPlayMonster)(BaseObject)).m_boButchUseItem)// 可以挖身上装备
                                                {
                                                    if (BaseObject.m_boGhost)
                                                    {
                                                        return result;
                                                    }
                                                    if (BaseObject.m_boButchSkeleton)
                                                    {
                                                        return result;
                                                    }
                                                    BaseObject.m_boButchSkeleton = true;  // 正在被挖尸体
                                                    try
                                                    {
                                                        for (int I = m_UseItems.GetLowerBound(0); I <= m_UseItems.GetUpperBound(0); I++)
                                                        {
                                                            if (BaseObject.m_boGhost)
                                                            {
                                                                return result;
                                                            }
                                                            if (HUtil32.GetTickCount() - BaseObject.m_dwDeathTick > (GameConfig.dwMakeGhostPlayMosterTime - 2000))
                                                            {
                                                                return result;  // 如果快要清理尸体时，则不再进入
                                                            }
                                                            if (HUtil32.Random(((TPlayMonster)(BaseObject)).m_nButchRate) != 0)
                                                            {
                                                                continue;    // 挖取身上装备机率0为百分百，数字越大，机率越小
                                                            }
                                                            K = HUtil32.Random(14);// 修正不能挖到斗笠位物品
                                                            if (M2Share.InDisableTakeOffList(((TPlayMonster)(BaseObject)).m_UseItems[K]->wIndex) || (((TPlayMonster)(BaseObject)).m_UseItems[K]->wIndex == 0))
                                                            {
                                                                continue;// 检查是否在禁止取下列表,如果在列表中则不掉此物品
                                                            }
                                                            StdItem = UserEngine.GetStdItem(((TPlayMonster)(BaseObject)).m_UseItems[K]->wIndex);
                                                            nCode = 17;
                                                            if ((StdItem != null))
                                                            {
                                                                switch (ButchChargeClass)
                                                                {
                                                                    case 0:// 挖取到物品后减所需的条件的数量 金币模式
                                                                        this.m_nGold -= ButchChargeCount;
                                                                        this.GoldChanged();
                                                                        break;
                                                                    case 1:// 更新玩家的金币 元宝模式
                                                                        m_nGameGold -= ButchChargeCount;
                                                                        this.GameGoldChanged();
                                                                        break;
                                                                    case 2:// 更新元宝数量 金刚石模式
                                                                        m_nGAMEDIAMOND -= ButchChargeCount;
                                                                        this.GameGoldChanged();
                                                                        break;
                                                                    case 3:// 更新金刚石数量 灵符模式
                                                                        m_nGAMEGIRD -= ButchChargeCount;
                                                                        this.GameGoldChanged();// 更新灵符数量
                                                                        m_UseGameGird = ButchChargeCount;// 灵符使用计数
                                                                        if (M2Share.g_FunctionNPC != null)
                                                                        {
                                                                            M2Share.g_FunctionNPC.GotoLable(this, "@USEGAMEGIRD", false); // 灵符使用触发
                                                                        }
                                                                        break;
                                                                }
                                                                if (((TPlayMonster)BaseObject).m_UseItems[K]->wIndex != 0)
                                                                {
                                                                    UserItem = ((TPlayMonster)(BaseObject)).m_UseItems[K];
                                                                    this.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTBUTCHMON, 0, 0, 0, "");// 人物挖尸体得到物品显示
                                                                    ((TPlayMonster)BaseObject).m_UseItems[K]->wIndex = 0;
                                                                    sCheckItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                                                                    nCode = 22;
                                                                    this.PlugOfCheckCanItem(7, sCheckItemName, false, 0, 0);// 禁止物品规则(管理插件功能)
                                                                    if (IsEnoughBag() && this.IsAddWeightAvailable(StdItem->Weight))// 物品是数据库里的物品,并人物的负重没有超过
                                                                    {
                                                                        if (StdItem->NeedIdentify == 1)
                                                                        {
                                                                            M2Share.AddGameDataLog("37" + "\09" + this.m_sMapName + "\09" + this.m_nCurrX + "\09" +
                                                                            this.m_nCurrY + "\09" + this.m_sCharName + "\09" + HUtil32.SBytePtrToString(StdItem->Name, StdItem->NameLen)
                                                                            + "\09" + (UserItem->MakeIndex).ToString() + "\09" + "(" + HUtil32.LoWord(StdItem->DC) + "/"
                                                                            + (HUtil32.HiWord(StdItem->DC)).ToString() + ")" + "(" + HUtil32.LoWord(StdItem->MC) + "/" + HUtil32.HiWord(StdItem->MC) + ")"
                                                                            + "(" + HUtil32.LoWord(StdItem->SC) + "/" + HUtil32.HiWord(StdItem->SC) + ")" + "(" + HUtil32.LoWord(StdItem->AC) + "/"
                                                                            + HUtil32.HiWord(StdItem->AC) + ")" + "(" + HUtil32.LoWord(StdItem->MAC) + "/" + HUtil32.HiWord(StdItem->MAC) + ")" +
                                                                            UserItem->btValue[0] + "/" + UserItem->btValue[1] + "/" + UserItem->btValue[2] + "/" + UserItem->btValue[3] + "/"
                                                                            + UserItem->btValue[4] + "/" + (UserItem->btValue[5]).ToString() + "/" + (UserItem->btValue[6]).ToString()
                                                                            + "/" + UserItem->btValue[7] + "/" + UserItem->btValue[8] + "/" + UserItem->btValue[14] + "\09" + BaseObject.m_sCharName);
                                                                        }
                                                                        this.m_ItemList.Add((IntPtr)UserItem);
                                                                        if (this.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                                                                        {
                                                                            SendAddItem(UserItem);
                                                                            SendUpdateItem(UserItem);// 更新物品
                                                                        }
                                                                        break;
                                                                    }
                                                                    else
                                                                    {
                                                                        nCode = 14;
                                                                        if (UserItem != null)
                                                                        {
                                                                            this.DropItemDown(UserItem, 3, false, false, this, this);
                                                                        }
                                                                        this.SysMsg(GameMsgDef.sButchEnoughBagHintMsg, TMsgColor.c_Red, TMsgType.t_Hint); // '您的包裹已没有办法装下任何物品!'
                                                                        break;
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    Marshal.FreeHGlobal((IntPtr)UserItem);
                                                                }
                                                            }
                                                        }
                                                    }
                                                    finally
                                                    {
                                                        BaseObject.m_boButchSkeleton = false;
                                                    }
                                                }
                                                else
                                                {
                                                    nCode = 23;
                                                    if ((BaseObject != null))
                                                    {
                                                        if (BaseObject.m_boGhost)
                                                        {
                                                            return result;
                                                        }
                                                        nCode = 232;
                                                        if (BaseObject.m_boButchSkeleton)
                                                        {
                                                            return result;
                                                        }
                                                        BaseObject.m_boButchSkeleton = true; // 正在被挖尸体
                                                        try
                                                        {
                                                            for (int I = ((TPlayMonster)(BaseObject)).m_ButchItemList.Count - 1; I >= 0; I--)
                                                            {
                                                                nCode = 233;
                                                                if (BaseObject.m_boGhost)
                                                                {
                                                                    return result;
                                                                }
                                                                nCode = 234;
                                                                if (HUtil32.GetTickCount() - BaseObject.m_dwDeathTick > (GameConfig.dwMakeGhostPlayMosterTime - 2000))
                                                                {
                                                                    return result;// 如果快要清理尸体时，则不再进入
                                                                }
                                                                nCode = 24;
                                                                if (((TPlayMonster)BaseObject).m_ButchItemList.Count <= 0)
                                                                {
                                                                    break;
                                                                }
                                                                MonItem = ((TMonItemInfo)(((TPlayMonster)(BaseObject)).m_ButchItemList[I]));
                                                                if (MonItem != null)
                                                                {
                                                                    if ((MonItem.ItemName).ToLower().CompareTo((M2Share.sSTRING_GOLDNAME).ToLower()) == 0) // 如果是金币
                                                                    {
                                                                        nCode = 25;
                                                                        this.m_nGold = this.m_nGold + MonItem.Count;
                                                                        this.GoldChanged();
                                                                        if (MonItem.Count > 0)
                                                                        {
                                                                            if (M2Share.g_boGameLogGold)
                                                                            {
                                                                                M2Share.AddGameDataLog("37" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString()
                                                                                    + "\09" + (this.m_nCurrY).ToString() + "\09" + this.m_sCharName + "\09" + M2Share.sSTRING_GOLDNAME
                                                                                    + "\09" + (MonItem.Count).ToString() + "\09" + "1" + "\09" + BaseObject.m_sCharName);
                                                                            }
                                                                        }
                                                                        if (BaseObject != null)
                                                                        {
                                                                            ((TPlayMonster)(BaseObject)).m_ButchItemList.RemoveAt(I);// 挖到后,删除对应的物品
                                                                        }
                                                                        switch (ButchChargeClass)
                                                                        {
                                                                            case 0:// 挖取到物品后减所需的条件的数量 金币模式
                                                                                this.m_nGold -= ButchChargeCount;
                                                                                this.GoldChanged();
                                                                                break;
                                                                            case 1:// 更新玩家的金币 元宝模式
                                                                                m_nGameGold -= ButchChargeCount;
                                                                                this.GameGoldChanged();
                                                                                break;
                                                                            case 2:// 更新元宝数量 金刚石模式
                                                                                m_nGAMEDIAMOND -= ButchChargeCount;
                                                                                this.GameGoldChanged();
                                                                                break;
                                                                            case 3:// 更新金刚石数量  灵符模式
                                                                                m_nGAMEGIRD -= ButchChargeCount;
                                                                                this.GameGoldChanged();// 更新灵符数量
                                                                                m_UseGameGird = ButchChargeCount;//灵符使用计数
                                                                                if (M2Share.g_FunctionNPC != null)
                                                                                {
                                                                                    M2Share.g_FunctionNPC.GotoLable(this, "@USEGAMEGIRD", false);// 灵符使用触发
                                                                                }
                                                                                break;
                                                                        }
                                                                        this.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTBUTCHMON, 0, 0, 0, "");// 挖尸体得到物品显示
                                                                        break;
                                                                    }
                                                                    else
                                                                    {
                                                                        nCode = 26;
                                                                        UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                                                                        if (UserEngine.CopyToUserItemFromName(MonItem.ItemName, UserItem))
                                                                        {
                                                                            UserItem->Dura = (ushort)HUtil32.Round((double)(UserItem->DuraMax / 100) * (20 + HUtil32.Random(80)));
                                                                            nCode = 27;
                                                                            if (HUtil32.Random(GameConfig.nPlayMonRandomAddValue) == 0)
                                                                            {
                                                                                UserEngine.RandomUpgradeItem(UserItem);
                                                                            }
                                                                            if ((UserItem != null))
                                                                            {
                                                                                switch (ButchChargeClass)
                                                                                {
                                                                                    case 0:// 挖取到物品后减所需的条件的数量 金币模式
                                                                                        this.m_nGold -= ButchChargeCount;
                                                                                        this.GoldChanged();
                                                                                        break;
                                                                                    case 1:// 更新玩家的金币 元宝模式
                                                                                        m_nGameGold -= ButchChargeCount;
                                                                                        this.GameGoldChanged();
                                                                                        break;
                                                                                    case 2:// 更新元宝数量 金刚石模式
                                                                                        m_nGAMEDIAMOND -= ButchChargeCount;
                                                                                        this.GameGoldChanged();
                                                                                        break;
                                                                                    case 3:// 更新金刚石数量  灵符模式
                                                                                        m_nGAMEGIRD -= ButchChargeCount;
                                                                                        this.GameGoldChanged();// 更新灵符数量
                                                                                        m_UseGameGird = ButchChargeCount;// 灵符使用计数
                                                                                        if (M2Share.g_FunctionNPC != null)
                                                                                        {
                                                                                            M2Share.g_FunctionNPC.GotoLable(this, "@USEGAMEGIRD", false);// 灵符使用触发
                                                                                        }
                                                                                        break;
                                                                                }
                                                                                nCode = 28;
                                                                                if (BaseObject != null)
                                                                                {
                                                                                    ((TPlayMonster)(BaseObject)).m_ButchItemList.RemoveAt(I);  // 挖到后,删除对应的物品
                                                                                }
                                                                                this.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTBUTCHMON, 0, 0, 0, "");// 人物挖尸体得到物品显示
                                                                                sCheckItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                                                                                nCode = 129;
                                                                                this.PlugOfCheckCanItem(7, sCheckItemName, false, 0, 0);// 禁止物品规则(管理插件功能)
                                                                                if (IsEnoughBag())  // 人物的包裹是否满了
                                                                                {
                                                                                    StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                                                                                    if (this.IsAddWeightAvailable(StdItem->Weight)) // 人物的负重没有超过
                                                                                    {
                                                                                        if (StdItem->NeedIdentify == 1)
                                                                                        {
                                                                                            M2Share.AddGameDataLog("37" + "\09" + this.m_sMapName
                                                                                                + "\09" + (this.m_nCurrX).ToString() + "\09" + (this.m_nCurrY).ToString()
                                                                                                + "\09" + this.m_sCharName + "\09" + HUtil32.SBytePtrToString(StdItem->Name, 0, StdItem->NameLen) + "\09"
                                                                                                + (UserItem->MakeIndex).ToString() + "\09" + "(" + (HUtil32.LoWord(StdItem->DC)).ToString() + "/"
                                                                                                + (HUtil32.HiWord(StdItem->DC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MC)).ToString()
                                                                                                + "/" + (HUtil32.HiWord(StdItem->MC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->SC)).ToString() + "/"
                                                                                                + (HUtil32.HiWord(StdItem->SC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->AC)).ToString() + "/" + (HUtil32.HiWord(StdItem->AC)).ToString() + ")"
                                                                                                + "(" + (HUtil32.LoWord(StdItem->MAC)).ToString() + "/" + (HUtil32.HiWord(StdItem->MAC)).ToString() + ")" + (UserItem->btValue[0]).ToString() + "/"
                                                                                                + (UserItem->btValue[1]).ToString() + "/" + (UserItem->btValue[2]).ToString() + "/" + (UserItem->btValue[3]).ToString() + "/"
                                                                                                + (UserItem->btValue[4]).ToString() + "/" + (UserItem->btValue[5]).ToString() + "/" + (UserItem->btValue[6]).ToString() + "/"
                                                                                                + (UserItem->btValue[7]).ToString() + "/" + (UserItem->btValue[8]).ToString() + "/" + (UserItem->btValue[14]).ToString() + "\09" + BaseObject.m_sCharName);
                                                                                        }
                                                                                        this.m_ItemList.Add((IntPtr)UserItem);
                                                                                        nCode = 30;
                                                                                        if (this.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                                                                                        {
                                                                                            SendAddItem(UserItem); // 一次只给玩家一件物品
                                                                                            SendUpdateItem(UserItem); // 更新物品
                                                                                        }
                                                                                        break;
                                                                                    }
                                                                                }
                                                                                else
                                                                                {
                                                                                    nCode = 31;
                                                                                    this.DropItemDown(UserItem, 3, false, false, this, this);// '您的包裹已没有办法装下任何物品!'
                                                                                    this.SysMsg(GameMsgDef.sButchEnoughBagHintMsg, TMsgColor.c_Red, TMsgType.t_Hint);// 一次只给玩家一件物品 20080121
                                                                                    break;
                                                                                }
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            Marshal.FreeHGlobal((IntPtr)UserItem);
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                        finally
                                                        {
                                                            BaseObject.m_boButchSkeleton = false;
                                                        }
                                                    }
                                                }
                                            }
                                            break;
                                        case 2:
                                        case 3:
                                            if (!IsEnoughBag())
                                            {
                                                this.SysMsg(GameMsgDef.sButchEnoughBagHintMsg, TMsgColor.c_Red, TMsgType.t_Hint);// '您的包裹已没有办法装下任何物品!'
                                            }
                                            if ((BaseObject != null) && (M2Share.g_FunctionNPC != null) && ((TPlayMonster)(BaseObject)).boIntoTrigger && IsEnoughBag())
                                            {
                                                nCode = 35;
                                                if (M2Share.g_FunctionNPC.m_boGotoCount < 80)
                                                {
                                                    nItemCount = (byte)this.m_ItemList.Count;// 进入触发段前的包裹物品数量 
                                                    nLevel = this.m_Abil.Level;// 进入触发段前的等级 
                                                    nExp = this.m_Abil.Exp;// 进入触发段前的经验 
                                                    nGameDiamond = m_nGAMEDIAMOND;// 进入触发段前的金刚石 
                                                    nCreditPoint = m_btCreditPoint;// 进入触发段前的声望 
                                                    nGameGird = m_nGAMEGIRD;// 进入触发段前的灵符 
                                                    M2Share.g_FunctionNPC.GotoLable(this, "@ButchCloneItem" + BaseObject.m_sCharName, false);
                                                    if ((nItemCount < this.m_ItemList.Count) || ((nExp < this.m_Abil.Exp) && (nLevel == this.m_Abil.Level)) || ((nExp > this.m_Abil.Exp) && (nLevel < this.m_Abil.Level)) || (nGameDiamond < m_nGAMEDIAMOND) || (nCreditPoint < m_btCreditPoint) || (nGameGird < m_nGAMEGIRD))
                                                    {
                                                        switch (ButchChargeClass)
                                                        {
                                                            case 0:// 挖取到物品后减所需的条件的数量 金币模式
                                                                this.m_nGold -= ButchChargeCount;
                                                                this.GoldChanged();
                                                                break;
                                                            case 1://更新玩家的金币 元宝模式
                                                                m_nGameGold -= ButchChargeCount;
                                                                this.GameGoldChanged();
                                                                break;
                                                            case 2:// 更新元宝数量  金刚石模式
                                                                m_nGAMEDIAMOND -= ButchChargeCount;
                                                                this.GameGoldChanged();
                                                                break;
                                                            case 3:// 更新金刚石数量 灵符模式
                                                                m_nGAMEGIRD -= ButchChargeCount;
                                                                this.GameGoldChanged();// 更新灵符数量
                                                                m_UseGameGird = ButchChargeCount;// 灵符使用计数
                                                                if (M2Share.g_FunctionNPC != null)
                                                                {
                                                                    M2Share.g_FunctionNPC.GotoLable(this, "@USEGAMEGIRD", false);  // 灵符使用触发
                                                                }
                                                                break;
                                                        }
                                                        this.SendRefMsg(Grobal2.RM_MYSHOW, Grobal2.ET_OBJECTBUTCHMON, 0, 0, 0, "");// 人物挖尸体得到物品显示
                                                    }
                                                }
                                            }
                                            break;
                                    }
                                }
                            }
                        }
                        break;
                    default:
                        nCode = 37;
                        if ((Math.Abs(nX - this.m_nCurrX) <= 2) && (Math.Abs(nY - this.m_nCurrY) <= 2))
                        {
                            nCode = 38;
                            if (this.m_PEnvir.IsValidObject(nX, nY, 2, BaseObject))
                            {
                                nCode = 39;
                                if (BaseObject.m_boDeath && (!BaseObject.m_boSkeleton) && (BaseObject.m_boAnimal))
                                {
                                    n10 = HUtil32.Random(16) + 5;
                                    n14 = HUtil32.Random(201) + 100;
                                    BaseObject.m_nBodyLeathery -= n10;
                                    BaseObject.m_nMeatQuality -= n14;
                                    nCode = 40;
                                    if (BaseObject.m_nMeatQuality < 0)
                                    {
                                        BaseObject.m_nMeatQuality = 0;
                                    }
                                    nCode = 41;
                                    if (BaseObject.m_nBodyLeathery <= 0)
                                    {
                                        if ((BaseObject.m_btRaceServer >= Grobal2.RC_ANIMAL) && (BaseObject.m_btRaceServer < Grobal2.RC_MONSTER))
                                        {
                                            BaseObject.m_boSkeleton = true;
                                            this.ApplyMeatQuality();// 设置肉的品质
                                            BaseObject.SendRefMsg(Grobal2.RM_SKELETON, BaseObject.m_btDirection, BaseObject.m_nCurrX, BaseObject.m_nCurrY, 0, "");// 彻底死了,不再有动作
                                        }
                                        if (!this.TakeBagItems(BaseObject))
                                        {
                                            this.SysMsg(GameMsgDef.sYouFoundNothing, TMsgColor.c_Red, TMsgType.t_Hint);// 未发现任何物品！！！
                                        }
                                        BaseObject.m_nBodyLeathery = 50;
                                    }

                                    this.m_dwDeathTick = HUtil32.GetTickCount();
                                }
                            }
                            this.m_btDirection = btDir;
                        }
                        nCode = 42;
                        break;
                }
                this.SendRefMsg(Grobal2.RM_BUTCH, this.m_btDirection, this.m_nCurrX, this.m_nCurrY, 0, "");// 让别人看到挖的动作
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.ClientGetButchItem Code:" + (nCode).ToString());
            }
            return result;
        }

        /// <summary>
        /// 客户端改变魔法快键
        /// </summary>
        /// <param name="nSkillIdx"></param>
        /// <param name="nKey"></param>
        private unsafe void ClientChangeMagicKey(int nSkillIdx, int nKey)
        {
            TUserMagic* UserMagic;
            if (this.m_MagicList.Count > 0)
            {
                for (int I = 0; I < this.m_MagicList.Count; I++)
                {
                    UserMagic = (TUserMagic*)this.m_MagicList[I];
                    if (UserMagic->MagicInfo.wMagicId == nSkillIdx)
                    {
                        UserMagic->btKey = (byte)nKey;
                        break;
                    }
                }
            }
        }

        /// <summary>
        /// 客户端关闭组队
        /// </summary>
        private void ClientGropuClose()
        {
            if (m_GroupOwner == null)
            {
                m_boAllowGroup = false;
                return;
            }
            if (m_GroupOwner != this)
            {
                m_GroupOwner.DelMember(this);
                m_boAllowGroup = false;
            }
            else
            {
                this.SysMsg("如果您想退出，使用编组功能（删除按钮）", TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        /// <summary>
        /// 新建组队
        /// </summary>
        /// <param name="sHumName"></param>
        private void ClientCreateGroup(string sHumName)
        {
            TPlayObject PlayObject;
            if (this.m_boDeath || this.m_boGhost)// 死亡后不能组队
            {
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumName);
            if (m_GroupOwner != null)
            {
                SendDefMessage(Grobal2.SM_CREATEGROUP_FAIL, -1, 0, 0, 0, "");
                return;
            }
            if ((PlayObject == null) || (PlayObject == this) || PlayObject.m_boDeath || PlayObject.m_boGhost)
            {
                SendDefMessage(Grobal2.SM_CREATEGROUP_FAIL, -2, 0, 0, 0, "");
                return;
            }
            if ((PlayObject.m_GroupOwner != null))
            {
                SendDefMessage(Grobal2.SM_CREATEGROUP_FAIL, -3, 0, 0, 0, "");
                return;
            }
            if ((!PlayObject.m_boAllowGroup))
            {
                SendDefMessage(Grobal2.SM_CREATEGROUP_FAIL, -4, 0, 0, 0, "");
                return;
            }
            m_GroupMembers.Clear();
            m_GroupMembers.Add(this);
            m_GroupMembers.Add(PlayObject);
            JoinGroup(this);
            PlayObject.JoinGroup(this);
            m_boAllowGroup = true;
            SendDefMessage(Grobal2.SM_CREATEGROUP_OK, 0, 0, 0, 0, "");
            SendGroupMembers();
        }

        /// <summary>
        /// 增加组队成员
        /// </summary>
        /// <param name="sHumName"></param>
        private void ClientAddGroupMember(string sHumName)
        {
            TPlayObject PlayObject;
            if (this.m_boDeath || this.m_boGhost) // 死亡后不能增加组队成员
            {
                return;
            }
            PlayObject = UserEngine.GetPlayObject(sHumName);
            if (m_GroupOwner != this)
            {
                SendDefMessage(Grobal2.SM_GROUPADDMEM_FAIL, -1, 0, 0, 0, "");// 编组还未成立
                return;
            }
            if (m_GroupMembers.Count > GameConfig.nGroupMembersMax) // 超过成员上限
            {
                SendDefMessage(Grobal2.SM_GROUPADDMEM_FAIL, -5, 0, 0, 0, "");// 您想邀请加入编组的人已经加入了其它组！
                return;
            }
            if ((PlayObject == null) || (PlayObject == this) || PlayObject.m_boDeath || PlayObject.m_boGhost)
            {
                SendDefMessage(Grobal2.SM_GROUPADDMEM_FAIL, -2, 0, 0, 0, "");// 输入的人物名称不正确
                return;
            }
            if ((PlayObject.m_GroupOwner != null))
            {
                SendDefMessage(Grobal2.SM_GROUPADDMEM_FAIL, -3, 0, 0, 0, "");// 已经加入编组
                return;
            }
            if ((!PlayObject.m_boAllowGroup)) // 对方不允许编组
            {
                SendDefMessage(Grobal2.SM_GROUPADDMEM_FAIL, -4, 0, 0, 0, "");
                return;
            }
            if (IsGroupMember(PlayObject))// 检查是否是组队里成员
            {
                SendDefMessage(Grobal2.SM_GROUPADDMEM_FAIL, -3, 0, 0, 0, "");// 已经加入编组
                return;
            }
            m_GroupMembers.Add(PlayObject);
            PlayObject.JoinGroup(this);
            SendDefMessage(Grobal2.SM_GROUPADDMEM_OK, 0, 0, 0, 0, "");
            SendGroupMembers();
        }

        /// <summary>
        /// 客户端删除组队成员
        /// </summary>
        /// <param name="sHumName"></param>
        private void ClientDelGroupMember(string sHumName)
        {
            TPlayObject PlayObject;
            PlayObject = UserEngine.GetPlayObject(sHumName);
            if (m_GroupOwner != this)
            {
                SendDefMessage(Grobal2.SM_GROUPDELMEM_FAIL, -1, 0, 0, 0, "");
                return;
            }
            if (PlayObject == null)
            {
                SendDefMessage(Grobal2.SM_GROUPDELMEM_FAIL, -2, 0, 0, 0, "");
                return;
            }
            if (!IsGroupMember(PlayObject))
            {
                SendDefMessage(Grobal2.SM_GROUPDELMEM_FAIL, -3, 0, 0, 0, "");
                return;
            }
            DelMember(PlayObject);
            SendDefMessage(Grobal2.SM_GROUPDELMEM_OK, 0, 0, 0, 0, sHumName);
        }

        // 判断对方是否面对面,是则可以交易
        private void ClientDealTry(string sHumName)
        {
            TBaseObject BaseObject;
            TPlayObject PlayObject;
            if (GameConfig.boDisableDeal)
            {
                this.SendMsg(M2Share.g_ManageNPC, Grobal2.RM_MENU_OK, 0, this.ToInt(), 0, 0, GameMsgDef.g_sDisableDealItemsMsg);
                return;
            }
            if (m_boDealing)
            {
                return;
            }
            if (HUtil32.GetTickCount() - m_DealLastTick < GameConfig.dwTryDealTime)// 3000
            {
                this.SendMsg(M2Share.g_ManageNPC, Grobal2.RM_MENU_OK, 0, this.ToInt(), 0, 0, GameMsgDef.g_sPleaseTryDealLaterMsg);
                return;
            }
            if (!m_boCanDeal)
            {
                this.SendMsg(M2Share.g_ManageNPC, Grobal2.RM_MENU_OK, 0, this.ToInt(), 0, 0, GameMsgDef.g_sCanotTryDealMsg);
                return;
            }
            BaseObject = this.GetPoseCreate();
            if ((BaseObject != null) && (BaseObject != this) && (BaseObject.m_btRaceServer == Grobal2.RC_PLAYOBJECT))
            {
                PlayObject = ((BaseObject) as TPlayObject);
                if ((PlayObject != null) && (PlayObject.GetPoseCreate() == this) && (!PlayObject.m_boDealing))
                {
                    if ((PlayObject.m_boAllowDeal && PlayObject.m_boCanDeal))
                    {
                        PlayObject.SysMsg(this.m_sCharName + GameMsgDef.g_sOpenedDealMsg, TMsgColor.c_Green, TMsgType.t_Hint);
                        this.SysMsg(PlayObject.m_sCharName + GameMsgDef.g_sOpenedDealMsg, TMsgColor.c_Green, TMsgType.t_Hint);
                        ((this) as TPlayObject).OpenDealDlg(PlayObject);
                        PlayObject.OpenDealDlg(this);
                    }
                    else
                    {
                        // '对方禁止进入交易'
                        this.SysMsg(GameMsgDef.g_sPoseDisableDealMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                }
                else
                {
                    SendDefMessage(Grobal2.SM_DEALTRY_FAIL, 0, 0, 0, 0, "");
                }
            }
            else
            {
                SendDefMessage(Grobal2.SM_DEALTRY_FAIL, 0, 0, 0, 0, "");
            }
        }

        // -------------------------元宝寄售系统-----------------------------------------
        // 交易成功后修改数据标识
        private unsafe void UpdateSellOffInfo(int code)
        {
            TDealOffInfo* DealOffInfo;
            if (bo_YBDEAL) // 已开通元宝服务
            {
                for (int I = M2Share.sSellOffItemList.Count - 1; I >= 0; I--)
                {
                    if (M2Share.sSellOffItemList.Count <= 0)
                    {
                        break;
                    }
                    DealOffInfo = ((TDealOffInfo*)(M2Share.sSellOffItemList[I]));
                    if ((DealOffInfo != null))
                    {
                        if ((DealOffInfo->N == 2))
                        {
                            switch (code)
                            {
                                case 0:// 出售者
                                    if (HUtil32.SBytePtrToString(DealOffInfo->sDealCharName, 0, DealOffInfo->DealCharNameLen) == this.m_sCharName)
                                    {
                                        M2Share.sSellOffItemList.RemoveAt(I);
                                        Marshal.FreeHGlobal((IntPtr)DealOffInfo);
                                        break;
                                    }
                                    break;
                                case 1:// 购买者
                                    if (HUtil32.SBytePtrToString(DealOffInfo->sBuyCharName, 0, DealOffInfo->BuyCharNameLen) == this.m_sCharName)
                                    {
                                        M2Share.sSellOffItemList.RemoveAt(I);
                                        Marshal.FreeHGlobal((IntPtr)DealOffInfo);
                                        break;
                                    }
                                    break;
                            }
                        }
                    }
                }
            }
        }

        // 客户端增加寄售物品到出售框中 
        private unsafe void ClientAddSellOffItem(int nItemIdx, string sItemName)
        {
            bool bo11;
            TUserItem* UserItem;
            string sUserItemName;
            m_boCanQueryBag = true;// 增加寄售物品时,不能刷新包裹
            try
            {
                if (sItemName.IndexOf(" ") >= 0)
                {
                    // 折分物品名称(信件物品的名称后面加了使用次数)
                    HUtil32.GetValidStr3(sItemName, ref sItemName, new string[] { " " });
                }
                bo11 = false;
                if (!m_boSellOffOK)
                {
                    for (int I = this.m_ItemList.Count - 1; I >= 0; I--)
                    {
                        if (this.m_ItemList.Count <= 0)
                        {
                            break;
                        }
                        UserItem = (TUserItem*)this.m_ItemList[I];
                        if (UserItem == null)
                        {
                            continue;
                        }
                        if (UserItem->MakeIndex == nItemIdx)
                        {
                            sUserItemName = "";  // 取自定义物品名称
                            if (UserItem->btValue[13] == 1)
                            {
                                sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                            }
                            if (sUserItemName == "")
                            {
                                sUserItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                            }
                            if (((sUserItemName).ToLower().CompareTo((sItemName).ToLower()) == 0) && (m_SellOffItemList.Count < 9))
                            {
                                if (this.CheckItemValue(UserItem, 1))//禁止交易
                                {
                                    break;
                                }
                                else if (this.PlugOfCheckCanItem(1, sUserItemName, false, 0, 0))  // 禁止物品规则(管理插件功能)
                                {
                                    break;
                                }
                                m_SellOffItemList.Add((IntPtr)UserItem);
                                this.SendMsg(this, Grobal2.RM_SELLOFFADDITEM_OK, 0, 0, 0, 0, "");// 放物品成功
                                this.m_ItemList.RemoveAt(I);
                                ClearCopyItem(0, UserItem->wIndex, UserItem->MakeIndex);// 清理包裹和仓库复制物品
                                bo11 = true;
                                break;
                            }
                        }
                    }
                }
                if (!bo11)
                {
                    this.SendMsg(this, Grobal2.RM_SellOffADDITEM_FAIL, 0, 0, 0, 0, "");
                }
            }
            finally
            {
                m_boCanQueryBag = false;// 增加寄售物品时,不能刷新包裹
            }
        }

        // 客户端删除出售物品窗里的物品
        private unsafe void ClientDelSellOffItem(int nItemIdx, string sItemName)
        {
            bool bo11;
            TUserItem* UserItem = null;
            string sUserItemName;
            if (sItemName.IndexOf(" ") >= 0)
            {
                // 折分物品名称(信件物品的名称后面加了使用次数)
                HUtil32.GetValidStr3(sItemName, ref sItemName, new string[] { " " });
            }
            bo11 = false;
            if (!m_boSellOffOK)
            {
                for (int I = m_SellOffItemList.Count - 1; I >= 0; I--)
                {
                    if (m_SellOffItemList.Count <= 0)
                    {
                        break;
                    }
                    UserItem = (TUserItem*)m_SellOffItemList[I];
                    if (UserItem == null)
                    {
                        continue;
                    }
                    if (UserItem->MakeIndex == nItemIdx)
                    {
                        // 取自定义物品名称
                        sUserItemName = "";
                        if (UserItem->btValue[13] == 1)
                        {
                            sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                        }
                        if (sUserItemName == "")
                        {
                            sUserItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                        }
                        if ((sUserItemName).ToLower().CompareTo((sItemName).ToLower()) == 0)
                        {
                            ClearCopyItem(0, UserItem->wIndex, UserItem->MakeIndex);// 清理包裹和仓库复制物品
                            this.m_ItemList.Add((IntPtr)UserItem);
                            this.SendMsg(this, Grobal2.RM_SELLOFFDELITEM_OK, 0, 0, 0, 0, "");
                            m_SellOffItemList.RemoveAt(I);
                            bo11 = true;
                            break;
                        }
                    }
                }
            }
            if (!bo11)
            {
                this.SendMsg(this, Grobal2.RM_SELLOFFDELITEM_FAIL, 0, 0, 0, 0, "");
            }
        }

        // 客户端元宝寄售结束(出售物品)
        // 出售人取消正在出售中的交易
        private unsafe void ClientCancelSellOffIng()
        {
            TDealOffInfo* DealOffInfo;
            TStdItem* StdItem;
            TUserItem* UserItem;
            byte nCode;
            nCode = 0;
            try
            {
                if ((M2Share.sSellOffItemList == null) || (M2Share.sSellOffItemList.Count == 0) || (!IsEnoughBag()))
                {
                    return;
                }
                for (int I = M2Share.sSellOffItemList.Count - 1; I >= 0; I--)
                {
                    if (M2Share.sSellOffItemList.Count <= 0)
                    {
                        break;
                    }
                    nCode = 1;
                    DealOffInfo = ((TDealOffInfo*)(M2Share.sSellOffItemList[I]));
                    nCode = 2;
                    if ((DealOffInfo != null))
                    {
                        nCode = 12;
                        if (((HUtil32.SBytePtrToString(DealOffInfo->sDealCharName, 0, DealOffInfo->DealCharNameLen)).ToLower().CompareTo((this.m_sCharName).ToLower()) == 0)
                            && ((DealOffInfo->N == 0) || (DealOffInfo->N == 3)))
                        {
                            DealOffInfo->N = 4;//正在操作中
                            nCode = 3;
                            TUserItem* UseItems = (TUserItem*)DealOffInfo->UseItemsBuff;
                            for (int K = 0; K <= 9; K++)
                            {
                                nCode = 4;
                                StdItem = UserEngine.GetStdItem(UseItems[K].wIndex);
                                if ((StdItem != null))
                                {
                                    nCode = 5;
                                    UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                                    UserItem = &UseItems[K];
                                    nCode = 6;
                                    if (IsEnoughBag()) // 人物的包裹是否满了
                                    {
                                        if (this.IsAddWeightAvailable(StdItem->Weight))// 检查负重
                                        {
                                            nCode = 7;
                                            if (this.AddItemToBag(UserItem))
                                            {
                                                SendAddItem(UserItem);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        this.DropItemDown(UserItem, 3, false, false, this, this);
                                    }
                                }
                                else if ((UseItems[K].MakeIndex > 0) && (UseItems[K].wIndex == ushort.MaxValue) &&
                                    (UseItems[K].Dura == ushort.MaxValue) && (UseItems[K].DuraMax == ushort.MaxValue)) // 是金刚石
                                {
                                    nCode = 8;
                                    m_nGAMEDIAMOND += UseItems[K].MakeIndex;// 增加金刚石
                                    nCode = 9;
                                    this.GameGoldChanged();// 更新金刚石数量
                                }
                            }
                            nCode = 10;
                            M2Share.sSellOffItemList.RemoveAt(I);
                            Marshal.FreeHGlobal((IntPtr)DealOffInfo);
                            nCode = 11;
                            this.SendMsg(this, Grobal2.RM_MENU_OK, 0, HUtil32.ObjectToInt(this), 0, 0, "取消寄售成功！");
                            // FrmDB.SaveSellOffItemList;//保存元宝寄售列表
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.ClientCancelSellOffIng Code:" + nCode);
            }
        }

        // 出售人取消正在出售中的交易
        // 购买人取消交易
        private unsafe void ClientBuyCancelSellOff(string DealCharName)
        {
            TDealOffInfo* DealOffInfo;
            for (int I = M2Share.sSellOffItemList.Count - 1; I >= 0; I--)
            {
                if (M2Share.sSellOffItemList.Count <= 0)
                {
                    break;
                }
                DealOffInfo = ((TDealOffInfo*)(M2Share.sSellOffItemList[I]));
                if ((DealOffInfo != null))
                {
                    if (((HUtil32.SBytePtrToString(DealOffInfo->sDealCharName, 0, DealOffInfo->DealCharNameLen)).ToLower().CompareTo((DealCharName).ToLower()) == 0)
                        && ((HUtil32.SBytePtrToString(DealOffInfo->sBuyCharName, 0, DealOffInfo->BuyCharNameLen)).ToLower().CompareTo((this.m_sCharName).ToLower()) == 0) && (DealOffInfo->N == 0))
                    {
                        DealOffInfo->N = 3;// 购买人取消标识
                        this.SendMsg(this, Grobal2.RM_MENU_OK, 0, HUtil32.ObjectToInt(this), 0, 0, "取消交易成功！");
                        break;
                    }
                }
            }
        }

        /// <summary>
        /// 购买寄售物品
        /// </summary>
        /// <param name="DealCharName"></param>
        private unsafe void ClientBuySellOffItme(string DealCharName)
        {
            TDealOffInfo* DealOffInfo;
            TStdItem* StdItem;
            TUserItem* UserItem;
            TPlayObject PlayObject;
            byte nCode;
            nCode = 0;
            try
            {
                for (int I = M2Share.sSellOffItemList.Count - 1; I >= 0; I--)
                {
                    if (M2Share.sSellOffItemList.Count <= 0)
                    {
                        break;
                    }
                    nCode = 1;
                    DealOffInfo = ((TDealOffInfo*)(M2Share.sSellOffItemList[I]));
                    if ((DealOffInfo != null))
                    {
                        if (((HUtil32.SBytePtrToString(DealOffInfo->sDealCharName, 0, DealOffInfo->DealCharNameLen)).ToLower().CompareTo((DealCharName).ToLower()) == 0)
                            && ((HUtil32.SBytePtrToString(DealOffInfo->sBuyCharName, 0, DealOffInfo->BuyCharNameLen)).ToLower().CompareTo((this.m_sCharName).ToLower()) == 0) && (DealOffInfo->N == 0))
                        {
                            nCode = 2;
                            DealOffInfo->N = 4; // 正在操作中
                            if (m_nGameGold >= (DealOffInfo->nSellGold + GameConfig.nDecUserGameGold))  // 每次扣多少元宝(元宝寄售)
                            {
                                m_nGameGold -= DealOffInfo->nSellGold + GameConfig.nDecUserGameGold;// 扣出元宝
                                if (m_nGameGold < 0)
                                {
                                    m_nGameGold = 0;
                                }
                                this.GameGoldChanged();// 更新元宝数量
                                nCode = 3;
                                PlayObject = UserEngine.GetPlayObject(HUtil32.SBytePtrToString(DealOffInfo->sDealCharName, 0, DealOffInfo->DealCharNameLen));// 给出售人元宝
                                if (PlayObject == null)// 出售人不在线
                                {
                                    DealOffInfo->N = 1;// 物品已出售,出售人未得到元宝
                                }
                                else
                                {
                                    if (PlayObject.m_boNotOnlineAddExp) // 挂机
                                    {
                                        DealOffInfo->N = 1;// 物品已出售,出售人未得到元宝
                                    }
                                    else
                                    {
                                        nCode = 10;
                                        UpdateSellOffInfo(1);
                                        DealOffInfo->N = 2;// 交易结束
                                        PlayObject.m_nGameGold += DealOffInfo->nSellGold;
                                        PlayObject.GameGoldChanged();
                                        nCode = 7;
                                        PlayObject.SysMsg(string.Format(GameMsgDef.sGetSellOffGlod, new int[] { DealOffInfo->nSellGold }), TMsgColor.c_Red, TMsgType.t_Hint);
                                        nCode = 8;
                                        if (M2Share.g_boGameLogGameGold)
                                        {
                                            M2Share.AddGameDataLog(string.Format(GameMsgDef.g_sGameLogMsg1, M2Share.LOG_GAMEGOLD, PlayObject.m_sMapName,
                                                PlayObject.m_nCurrX, PlayObject.m_nCurrY, PlayObject.m_sCharName, GameConfig.sGameGoldName,
                                                PlayObject.m_nGameGold, "寄售获得(" + (DealOffInfo->nSellGold).ToString() + ")", this.m_sCharName));
                                        }
                                    }
                                }
                                // FrmDB.SaveSellOffItemList;//保存元宝寄售列表
                                TUserItem* UseItems = (TUserItem*)DealOffInfo->UseItemsBuff;
                                for (int K = 0; K <= 9; K++)
                                {
                                    StdItem = UserEngine.GetStdItem(UseItems[K].wIndex);
                                    if ((StdItem != null))
                                    {
                                        nCode = 12;
                                        UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                                        UserItem = UseItems;
                                        nCode = 13;
                                        if (IsEnoughBag()) // 检查人物的包裹是否满了
                                        {
                                            ClearCopyItem(0, UserItem->wIndex, UserItem->MakeIndex);// 清理包裹和仓库复制物品
                                            if (this.AddItemToBag(UserItem))
                                            {
                                                nCode = 14;
                                                SendAddItem(UserItem);
                                                if (StdItem->NeedIdentify == 1)
                                                {
                                                    M2Share.AddGameDataLog("9" + "\09" + this.m_sMapName + "(*)" + "\09" + (this.m_nCurrX).ToString()
                                                        + "\09" + (this.m_nCurrY).ToString() + "\09" + this.m_sCharName + "\09" + HUtil32.SBytePtrToString(StdItem->Name, 0, StdItem->NameLen) + "\09"
                                                        + (UserItem->MakeIndex).ToString() + "\09" + "(" + (HUtil32.LoWord(StdItem->DC)).ToString() + "/"
                                                        + (HUtil32.HiWord(StdItem->DC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MC)).ToString() + "/"
                                                        + (HUtil32.HiWord(StdItem->MC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->SC)).ToString() + "/"
                                                        + (HUtil32.HiWord(StdItem->SC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->AC)).ToString() + "/"
                                                        + (HUtil32.HiWord(StdItem->AC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MAC)).ToString() + "/"
                                                        + (HUtil32.HiWord(StdItem->MAC)).ToString() + ")" + (UserItem->btValue[0]).ToString() + "/" + (UserItem->btValue[1]).ToString()
                                                        + "/" + (UserItem->btValue[2]).ToString() + "/" + (UserItem->btValue[3]).ToString() + "/" + (UserItem->btValue[4]).ToString()
                                                        + "/" + (UserItem->btValue[5]).ToString() + "/" + (UserItem->btValue[6]).ToString() + "/" + (UserItem->btValue[7]).ToString()
                                                        + "/" + (UserItem->btValue[8]).ToString() + "/" + (UserItem->btValue[14]).ToString() + "\09"
                                                        + HUtil32.SBytePtrToString(DealOffInfo->sDealCharName, 0, DealOffInfo->DealCharNameLen));
                                                }
                                            }
                                        }
                                        else
                                        {
                                            this.DropItemDown(UserItem, 3, false, false, this, this); //包裹没位了,则把物品扔出来
                                        }
                                    }
                                    // 是金刚石
                                    else if ((UseItems[K].MakeIndex > 0) && (UseItems[K].wIndex == ushort.MaxValue) &&
                                        (UseItems[K].Dura == ushort.MaxValue) && (UseItems[K].DuraMax == ushort.MaxValue))
                                    {
                                        nCode = 15;
                                        m_nGAMEDIAMOND += UseItems[K].MakeIndex;// 增加金刚石
                                        this.SysMsg(UseItems[K].MakeIndex + " 颗金刚石增加", TMsgColor.c_Blue, TMsgType.t_Hint);
                                    }
                                }
                                nCode = 16;
                                this.SendMsg(this, Grobal2.RM_SELLOFFBUY_OK, 0, 0, 0, 0, "");// 购买成功
                                this.SendMsg(this, Grobal2.RM_MENU_OK, 0, HUtil32.ObjectToInt(this), 0, 0, "[成功] 系统已经成功接受您的申请");
                                break;
                            }
                            else
                            {
                                DealOffInfo->N = 0;//购买不成功则改为原来的状态
                                this.SendMsg(this, Grobal2.RM_MENU_OK, 0, HUtil32.ObjectToInt(this), 0, 0, "[错误] 您的申请提交不成功");
                                break;
                            }
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.ClientBuySellOffItme Code:" + (nCode).ToString());
            }
        }

        /// <summary>
        /// 人物上线,检查是否有交易结束还没得到元宝
        /// </summary>
        private unsafe void GetSellOffGlod()
        {
            TDealOffInfo* DealOffInfo;
            byte nCode;
            nCode = 0;
            if (m_boNotOnlineAddExp)  // 挂机则退出
            {
                return;
            }
            try
            {
                for (int I = M2Share.sSellOffItemList.Count - 1; I >= 0; I--)
                {
                    nCode = 1;
                    if (M2Share.sSellOffItemList.Count <= 0)
                    {
                        break;
                    }
                    nCode = 2;
                    DealOffInfo = ((TDealOffInfo*)(M2Share.sSellOffItemList[I]));
                    nCode = 3;
                    if ((DealOffInfo != null))
                    {
                        if (((HUtil32.SBytePtrToString(DealOffInfo->sDealCharName, 0, DealOffInfo->DealCharNameLen)).ToLower().CompareTo((this.m_sCharName).ToLower()) == 0)
                            && (DealOffInfo->N == 1))
                        {
                            nCode = 4;
                            UpdateSellOffInfo(0);
                            nCode = 5;
                            DealOffInfo->N = 2;// 交易结束
                            nCode = 7;
                            m_nGameGold += DealOffInfo->nSellGold;
                            this.GameGoldChanged();
                            nCode = 8;
                            this.SysMsg(string.Format(GameMsgDef.sGetSellOffGlod, DealOffInfo->nSellGold), TMsgColor.c_Red, TMsgType.t_Hint);
                            nCode = 9;
                            if (M2Share.g_boGameLogGameGold)
                            {
                                M2Share.AddGameDataLog(string.Format(GameMsgDef.g_sGameLogMsg1, M2Share.LOG_GAMEGOLD, this.m_sMapName, this.m_nCurrX,
                                    this.m_nCurrY, this.m_sCharName, GameConfig.sGameGoldName,
                                    m_nGameGold, "寄售获得(" + (DealOffInfo->nSellGold).ToString() + ")",
                                    HUtil32.SBytePtrToString(DealOffInfo->sBuyCharName, 0, DealOffInfo->BuyCharNameLen)));
                            }
                            break;
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.GetSellOffGlod Code:" + nCode);
            }
        }

        /// <summary>
        /// 客户端取消元宝寄售
        /// </summary>
        private void ClientCancelSellOff()
        {
            SellOffCancel();
        }

        /// <summary>
        /// 查询玩家交易记录
        /// </summary>
        /// <returns></returns>
        public unsafe string SelectSellDate()
        {
            string result = "您未开通元宝寄售服务,请先开通！！！\\ \\<返回/@main>";
            TDealOffInfo* DealOffInfo;
            if (bo_YBDEAL)// 已开通元宝服务
            {
                if (M2Share.sSellOffItemList.Count > 0)
                {
                    for (int I = 0; I < M2Share.sSellOffItemList.Count; I++)
                    {
                        DealOffInfo = ((TDealOffInfo*)(M2Share.sSellOffItemList[I]));
                        if ((DealOffInfo != null))
                        {
                            if (((HUtil32.SBytePtrToString(DealOffInfo->sDealCharName, DealOffInfo->DealCharNameLen)).ToLower().CompareTo((this.m_sCharName).ToLower()) == 0)
                                && (DealOffInfo->N == 2))
                            {
                                result = "最后一笔出售记录:\\" + HUtil32.FormatDateTime("   yyyy年mm月dd日 hh时nn分", DealOffInfo->dSellDateTime) +
                                    ",\\  您与" + HUtil32.SBytePtrToString(DealOffInfo->sBuyCharName, DealOffInfo->BuyCharNameLen) + "交易成功,获得了" + DealOffInfo->nSellGold
                                    + "个" + GameConfig.sGameGoldName +
                                    "。\\ \\<返回/@main>";
                                return result;
                            }
                            else if (((HUtil32.SBytePtrToString(DealOffInfo->sBuyCharName, DealOffInfo->BuyCharNameLen)).ToLower().CompareTo((this.m_sCharName).ToLower()) == 0)
                                && ((DealOffInfo->N == 1) || (DealOffInfo->N == 2)))
                            {
                                result = "最后一笔购买记录:\\" + HUtil32.FormatDateTime("   yyyy年mm月dd日 hh时nn分", DealOffInfo->dSellDateTime) +
                                    ",\\  您与" + HUtil32.SBytePtrToString(DealOffInfo->sDealCharName, DealOffInfo->DealCharNameLen) + "交易成功,支付了" + DealOffInfo->nSellGold + "个" +
                                    GameConfig.sGameGoldName + "。\\ \\<返回/@main>";
                                return result;
                            }
                        }
                    }
                }
                result = "您未进行任何寄售交易！！！\\ \\<返回/@main>";
            }
            return result;
        }

        /// <summary>
        /// 查询玩家是否操作过寄售
        /// </summary>
        /// <param name="nCode"></param>
        /// <returns></returns>
        public unsafe bool SellOffInTime(int nCode)
        {
            bool result = false;
            TDealOffInfo* DealOffInfo;
            if (M2Share.sSellOffItemList.Count > 0)
            {
                for (int I = 0; I < M2Share.sSellOffItemList.Count; I++)
                {
                    DealOffInfo = (TDealOffInfo*)M2Share.sSellOffItemList[I];
                    if (DealOffInfo != null)
                    {
                        switch (nCode)
                        {
                            case 0:// 出售者
                                if (((HUtil32.SBytePtrToString(DealOffInfo->sDealCharName, DealOffInfo->DealCharNameLen)).ToLower().CompareTo((this.m_sCharName).ToLower())
                                    == 0) && ((DealOffInfo->N == 0) || (DealOffInfo->N == 3)))
                                {
                                    result = true;
                                    break;
                                }
                                break;
                            case 1:// 购买者
                                if (((HUtil32.SBytePtrToString(DealOffInfo->sBuyCharName, DealOffInfo->BuyCharNameLen)).ToLower().CompareTo((this.m_sCharName).ToLower())
                                    == 0) && (DealOffInfo->N == 0))
                                {
                                    result = true;
                                    break;
                                }
                                break;
                        }
                    }
                }
            }
            return result;
        }

        /// <summary>
        /// 客户端元宝寄售结束   
        /// 把临时列表数据写入元宝寄售列表中,并清空临时列表
        /// </summary>
        /// <param name="sBuyCharName"></param>
        /// <param name="nSellGold"></param>
        /// <param name="nGAMEDIAMOND"></param>
        /// <param name="nCode"></param>
        private unsafe void ClientSellOffEnd(string sBuyCharName, int nSellGold, int nGAMEDIAMOND, int nCode)
        {
            bool bo11;
            TUserItem* UserItem;
            TStdItem* StdItem;
            TDealOffInfo* DealOffInfo;
            TUserItem* UseItems;
            m_boSellOffOK = true;
            bo11 = false;
            if (m_boSellOffOK && ((m_SellOffItemList.Count > 0) || (nGAMEDIAMOND > 0)) && (m_SellOffItemList.Count < 10)
                && (sBuyCharName.Length < Grobal2.ACTORNAMELEN + 1) && (nSellGold > 0) && (nSellGold < 100000) &&
                ((sBuyCharName).ToLower().CompareTo((this.m_sCharName).ToLower()) != 0))  // 不能自己寄售给自己
            {
                DealOffInfo = (TDealOffInfo*)Marshal.AllocHGlobal(sizeof(TDealOffInfo));
                for (int K = 0; K <= 9; K++)
                {
                    TUserItem* _wvar1 = (TUserItem*)DealOffInfo->UseItemsBuff[K];
                    _wvar1->MakeIndex = 0;
                    _wvar1->wIndex = 0;
                    _wvar1->Dura = 0;
                    _wvar1->DuraMax = 0;
                    _wvar1->btValue[0] = 0;
                    _wvar1->btValue[1] = 0;
                    _wvar1->btValue[2] = 0;
                    _wvar1->btValue[3] = 0;
                    _wvar1->btValue[4] = 0;
                    _wvar1->btValue[5] = 0;
                    _wvar1->btValue[6] = 0;
                    _wvar1->btValue[7] = 0;
                    _wvar1->btValue[8] = 0;
                    _wvar1->btValue[9] = 0;
                    _wvar1->btValue[10] = 0;
                    _wvar1->btValue[11] = 0;
                    _wvar1->btValue[12] = 0;
                    _wvar1->btValue[13] = 0;
                    _wvar1->btValue[14] = 0;
                    _wvar1->btValue[15] = 0;
                    _wvar1->btValue[16] = 0;
                    _wvar1->btValue[17] = 0;
                    _wvar1->btValue[18] = 0;
                    _wvar1->btValue[19] = 0;
                    _wvar1->btValue[20] = 0;
                }
                if (m_SellOffItemList.Count > 0)
                {
                    for (int I = 0; I < m_SellOffItemList.Count; I++)
                    {
                        UserItem = (TUserItem*)m_SellOffItemList[I];
                        StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                        if ((StdItem != null) && (StdItem->StdMode == 51) && (StdItem->Shape == 0) && (UserItem->Dura > 0) && (UserItem->btValue[20] == 1)) // 是聚灵珠
                        {
                            n_UsesItemTick = 0;// 时间初始
                            UserItem->btValue[12] = 2; // 不能聚集的标识
                        }
                        if ((UserItem != null) && (UserItem->MakeIndex > 0))
                        {
                            UseItems = (TUserItem*)DealOffInfo->UseItemsBuff;
                            UseItems[I] = *UserItem;
                        }
                    }
                }
                UseItems = (TUserItem*)DealOffInfo->UseItemsBuff;
                for (int K = 0; K <= 9; K++)
                {
                    StdItem = UserEngine.GetStdItem(UseItems[K].wIndex);
                    if ((StdItem == null) && (nGAMEDIAMOND > 0) && (nGAMEDIAMOND < 10000) && (nCode == ushort.MaxValue))  // 物品是金刚石
                    {
                        if (nGAMEDIAMOND > m_nGAMEDIAMOND) // 金刚石数量大于玩家的数量时则反回失败
                        {
                            this.SendMsg(this, Grobal2.RM_SELLOFFEND_FAIL, 0, 0, 0, 0, "");
                            this.SendMsg(this, Grobal2.RM_MENU_OK, 0, HUtil32.ObjectToInt(this), 0, 0, "[错误] 你没有那么多" + GameConfig.sGameDiaMond);
                            GetBackSellOffItems();// 返回物品
                            return;
                        }
                        m_nGAMEDIAMOND -= nGAMEDIAMOND;
                        this.GameGoldChanged();// 更新金刚石数量
                        UseItems[K].MakeIndex = nGAMEDIAMOND;// 金刚石数量
                        UseItems[K].wIndex = ushort.MaxValue;
                        UseItems[K].Dura = ushort.MaxValue;
                        UseItems[K].DuraMax = ushort.MaxValue;
                        break;
                    }
                }
                HUtil32.StrToSByteArry(this.m_sCharName, DealOffInfo->sDealCharName, 14, ref DealOffInfo->DealCharNameLen);// 寄售人
                HUtil32.StrToSByteArry(sBuyCharName.Trim(), DealOffInfo->sBuyCharName, 14, ref DealOffInfo->BuyCharNameLen);// 购买人
                DealOffInfo->nSellGold = nSellGold;// 元宝数
                DealOffInfo->dSellDateTime = DateTime.Now;// 操作时间
                DealOffInfo->N = 0;// 标识
                M2Share.sSellOffItemList.Add((IntPtr)DealOffInfo);// 增加到元宝寄售列表中
                this.SendMsg(this, Grobal2.RM_SELLOFFEND_OK, 0, 0, 0, 0, "");
                m_nGameGold -= GameConfig.nDecUserGameGold;// 每次扣多少元宝(元宝寄售) 20080319
                if (m_nGameGold < 0)
                {
                    m_nGameGold = 0;
                }
                this.SendMsg(this, Grobal2.RM_MENU_OK, 0, HUtil32.ObjectToInt(this), 0, 0, "[成功] 系统已经成功接受您的申请");
                bo11 = true;
                // FrmDB.SaveSellOffItemList;//保存元宝寄售列表 20080317
                m_boSellOffOK = false;
                m_SellOffItemList.Clear();
            }
            if (!bo11)// 失败则返回物品给玩家
            {
                this.SendMsg(this, Grobal2.RM_SELLOFFEND_FAIL, 0, 0, 0, 0, "");
                this.SendMsg(this, Grobal2.RM_MENU_OK, 0, HUtil32.ObjectToInt(this), 0, 0, "[错误:] 寄售物品失败");
                GetBackSellOffItems();
            }
        }

        /// <summary>
        /// 客户端增加交易物品到交易框中
        /// </summary>
        /// <param name="nItemIdx"></param>
        /// <param name="sItemName"></param>
        private unsafe void ClientAddDealItem(int nItemIdx, string sItemName)
        {
            bool bo11;
            TUserItem* UserItem;
            string sUserItemName;
            if ((m_DealCreat == null) || !m_boDealing)
            {
                return;
            }
            m_boCanQueryBag = true;// 交易增加物品时,不能刷新包裹
            try
            {
                if (sItemName.IndexOf(" ") >= 0)// 折分物品名称(信件物品的名称后面加了使用次数)
                {
                    HUtil32.GetValidStr3(sItemName, ref sItemName, new string[] { " " });
                }
                bo11 = false;
                if (!m_DealCreat.m_boDealOK)
                {
                    for (int I = this.m_ItemList.Count - 1; I >= 0; I--)
                    {
                        if (this.m_ItemList.Count <= 0)
                        {
                            break;
                        }
                        UserItem = (TUserItem*)this.m_ItemList[I];
                        if (UserItem == null)
                        {
                            continue;
                        }
                        if (UserItem->MakeIndex == nItemIdx)
                        {
                            sUserItemName = ""; // 取自定义物品名称
                            if (UserItem->btValue[13] == 1)
                            {
                                sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                            }
                            if (sUserItemName == "")
                            {
                                sUserItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                            }
                            if (((sUserItemName).ToLower().CompareTo((sItemName).ToLower()) == 0) && (m_DealItemList.Count < 12))
                            {
                                if (this.CheckItemValue(UserItem, 1)) // 禁止交易
                                {
                                    break;
                                }
                                else if (this.PlugOfCheckCanItem(1, sUserItemName, false, 0, 0))// 禁止物品规则(管理插件功能)
                                {
                                    break;
                                }
                                m_DealItemList.Add((IntPtr)UserItem);
                                ((this) as TPlayObject).SendAddDealItem(UserItem);
                                this.m_ItemList.RemoveAt(I);
                                ClearCopyItem(0, UserItem->wIndex, UserItem->MakeIndex);// 清理包裹和仓库复制物品
                                bo11 = true;
                                break;
                            }
                        }
                    }
                }
                if (!bo11)
                {
                    SendDefMessage(Grobal2.SM_DEALADDITEM_FAIL, 0, 0, 0, 0, "");
                }
            }
            finally
            {
                m_boCanQueryBag = false;// 交易增加物品时,不能刷新包裹
            }
        }

        /// <summary>
        /// 客户端删除交易物品
        /// </summary>
        /// <param name="nItemIdx"></param>
        /// <param name="sItemName"></param>
        private unsafe void ClientDelDealItem(int nItemIdx, string sItemName)
        {
            bool bo11;
            TUserItem* UserItem;
            string sUserItemName;
            if (GameConfig.boCanNotGetBackDeal)// 禁止取回物品
            {
                this.SendMsg(M2Share.g_ManageNPC, Grobal2.RM_MENU_OK, 0, this.ToInt(), 0, 0, GameMsgDef.g_sDealItemsDenyGetBackMsg);
                SendDefMessage(Grobal2.SM_DEALDELITEM_FAIL, 0, 0, 0, 0, "");
                return;
            }
            if ((m_DealCreat == null) || !m_boDealing)
            {
                return;
            }
            if (sItemName.IndexOf(" ") >= 0)// 折分物品名称(信件物品的名称后面加了使用次数)
            {
                HUtil32.GetValidStr3(sItemName, ref sItemName, new string[] { " " });
            }
            bo11 = false;
            if (!m_DealCreat.m_boDealOK)
            {
                for (int I = m_DealItemList.Count - 1; I >= 0; I--)
                {
                    if (m_DealItemList.Count <= 0)
                    {
                        break;
                    }
                    UserItem = (TUserItem*)m_DealItemList[I];
                    if (UserItem == null)
                    {
                        continue;
                    }
                    if (UserItem->MakeIndex == nItemIdx)
                    {
                        sUserItemName = "";// 取自定义物品名称
                        if (UserItem->btValue[13] == 1)
                        {
                            sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                        }
                        if (sUserItemName == "")
                        {
                            sUserItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                        }
                        if ((sUserItemName).ToLower().CompareTo((sItemName).ToLower()) == 0)
                        {
                            this.m_ItemList.Add((IntPtr)UserItem);
                            ((this) as TPlayObject).SendDelDealItem(UserItem);
                            m_DealItemList.RemoveAt(I);
                            bo11 = true;
                            break;
                        }
                    }
                }
            }
            if (!bo11)
            {
                SendDefMessage(Grobal2.SM_DEALDELITEM_FAIL, 0, 0, 0, 0, "");
            }
        }

        /// <summary>
        /// 客户端取消交易
        /// </summary>
        private void ClientCancelDeal()
        {
            DealCancel();
        }

        /// <summary>
        /// 客户端把金币放到交易框中
        /// </summary>
        /// <param name="nGold"></param>
        private void ClientChangeDealGold(int nGold)
        {
            bool bo09;
            if ((m_nDealGolds > 0) && GameConfig.boCanNotGetBackDeal) // 禁止取回放入交易栏内的金币
            {
                this.SendMsg(M2Share.g_ManageNPC, Grobal2.RM_MENU_OK, 0, this.ToInt(), 0, 0, GameMsgDef.g_sDealItemsDenyGetBackMsg);
                SendDefMessage(Grobal2.SM_DEALDELITEM_FAIL, 0, 0, 0, 0, "");
                return;
            }
            if (nGold < 0)
            {
                SendDefMessage(Grobal2.SM_DEALCHGGOLD_FAIL, m_nDealGolds, HUtil32.LoWord(this.m_nGold), HUtil32.HiWord(this.m_nGold), 0, "");
                return;
            }
            bo09 = false;
            if ((m_DealCreat != null) && (this.GetPoseCreate() == m_DealCreat))
            {
                if (!m_DealCreat.m_boDealOK)
                {
                    if ((this.m_nGold + m_nDealGolds) >= nGold)
                    {
                        this.m_nGold = (this.m_nGold + m_nDealGolds) - nGold;
                        m_nDealGolds = nGold;
                        SendDefMessage(Grobal2.SM_DEALCHGGOLD_OK, m_nDealGolds, HUtil32.LoWord(this.m_nGold), HUtil32.HiWord(this.m_nGold), 0, "");
                        m_DealCreat.SendDefMessage(Grobal2.SM_DEALREMOTECHGGOLD, m_nDealGolds, 0, 0, 0, "");
                        m_DealCreat.m_DealLastTick = HUtil32.GetTickCount();
                        bo09 = true;
                        m_DealLastTick = HUtil32.GetTickCount();
                    }
                }
            }
            if (!bo09)
            {
                SendDefMessage(Grobal2.SM_DEALCHGGOLD_FAIL, m_nDealGolds, (ushort)HUtil32.LoWord(this.m_nGold), (ushort)HUtil32.HiWord(this.m_nGold), 0, "");
            }
        }

        /// <summary>
        /// 交易结束
        /// </summary>
        private unsafe void ClientDealEnd()
        {
            bool bo11;
            TUserItem* UserItem;
            TStdItem* StdItem;
            TPlayObject PlayObject;
            m_boDealOK = true;
            if (m_DealCreat == null)
            {
                return;
            }
            if (((HUtil32.GetTickCount() - m_DealLastTick) < GameConfig.dwDealOKTime) || ((HUtil32.GetTickCount() - m_DealCreat.m_DealLastTick) < GameConfig.dwDealOKTime))
            {
                this.SysMsg(GameMsgDef.g_sDealOKTooFast, TMsgColor.c_Red, TMsgType.t_Hint);
                DealCancel();
                return;
            }
            if (m_DealCreat.m_boDealOK)
            {
                bo11 = true;
                if ((Grobal2.MAXBAGITEM - this.m_ItemList.Count) < m_DealCreat.m_DealItemList.Count)
                {
                    bo11 = false;
                    this.SysMsg(GameMsgDef.g_sYourBagSizeTooSmall, TMsgColor.c_Red, TMsgType.t_Hint);
                }
                if ((this.m_nGoldMax - this.m_nGold) < m_DealCreat.m_nDealGolds)
                {
                    this.SysMsg(GameMsgDef.g_sYourGoldLargeThenLimit, TMsgColor.c_Red, TMsgType.t_Hint);
                    bo11 = false;
                }
                if ((Grobal2.MAXBAGITEM - m_DealCreat.m_ItemList.Count) < m_DealItemList.Count)
                {
                    this.SysMsg(GameMsgDef.g_sDealHumanBagSizeTooSmall, TMsgColor.c_Red, TMsgType.t_Hint);
                    bo11 = false;
                }
                if ((m_DealCreat.m_nGoldMax - m_DealCreat.m_nGold) < m_nDealGolds)
                {
                    this.SysMsg(GameMsgDef.g_sDealHumanGoldLargeThenLimit, TMsgColor.c_Red, TMsgType.t_Hint);
                    bo11 = false;
                }
                if (bo11)
                {
                    if (m_DealItemList.Count > 0)
                    {
                        for (int I = 0; I < m_DealItemList.Count; I++)
                        {
                            UserItem = (TUserItem*)m_DealItemList[I];
                            StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                            if ((StdItem != null) && (StdItem->StdMode == 51) && (StdItem->Shape == 0) && (UserItem->Dura > 0)
                                && (UserItem->btValue[20] == 1))// 是聚灵珠
                            {
                                n_UsesItemTick = 0;// 时间初始
                                UserItem->btValue[12] = 2;// 不能聚集的标识
                            }
                            m_DealCreat.ClearCopyItem(0, UserItem->wIndex, UserItem->MakeIndex);// 清理包裹和仓库复制物品
                            m_DealCreat.AddItemToBag(UserItem);
                            m_DealCreat.SendAddItem(UserItem);
                            if (StdItem != null)
                            {
                                if (StdItem->NeedIdentify == 1)
                                {
                                    M2Share.AddGameDataLog("8" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString() + "\09"
                                        + (this.m_nCurrY).ToString() + "\09" + this.m_sCharName + "\09" + HUtil32.SBytePtrToString(StdItem->Name, StdItem->NameLen) + "\09" + (UserItem->MakeIndex).ToString()
                                        + "\09" + "(" + (HUtil32.LoWord(StdItem->DC)).ToString() + "/" + (HUtil32.HiWord(StdItem->DC)).ToString() + ")" + "("
                                        + (HUtil32.LoWord(StdItem->MC)).ToString() + "/" + (HUtil32.HiWord(StdItem->MC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->SC)).ToString()
                                        + "/" + (HUtil32.HiWord(StdItem->SC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->AC)).ToString() + "/"
                                        + (HUtil32.HiWord(StdItem->AC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MAC)).ToString() + "/"
                                        + (HUtil32.HiWord(StdItem->MAC)).ToString() + ")" + (UserItem->btValue[0]).ToString() + "/" + (UserItem->btValue[1]).ToString() + "/"
                                        + (UserItem->btValue[2]).ToString() + "/" + (UserItem->btValue[3]).ToString() + "/" + (UserItem->btValue[4]).ToString() + "/"
                                        + (UserItem->btValue[5]).ToString() + "/" + (UserItem->btValue[6]).ToString() + "/" + (UserItem->btValue[7]).ToString() + "/"
                                        + (UserItem->btValue[8]).ToString() + "/" + (UserItem->btValue[14]).ToString() + "\09" + m_DealCreat.m_sCharName);
                                }
                            }
                        }
                    }
                    if (m_nDealGolds > 0)
                    {
                        m_DealCreat.m_nGold += m_nDealGolds;
                        m_DealCreat.GoldChanged();
                        if (M2Share.g_boGameLogGold)
                        {
                            M2Share.AddGameDataLog("8" + "\09" + this.m_sMapName + "\09" + this.m_nCurrX + "\09" + this.m_nCurrY
                                + "\09" + this.m_sCharName + "\09" + M2Share.sSTRING_GOLDNAME + "\09" + this.m_nGold + "\09" + "1" + "\09" + m_DealCreat.m_sCharName);
                        }
                    }
                    if (m_DealCreat.m_DealItemList.Count > 0)
                    {
                        for (int I = 0; I < m_DealCreat.m_DealItemList.Count; I++)
                        {
                            UserItem = (TUserItem*)m_DealCreat.m_DealItemList[I];
                            StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                            if ((StdItem != null) && (StdItem->StdMode == 51) && (StdItem->Shape == 0) && (UserItem->Dura > 0)
                                && (UserItem->btValue[20] == 1))// 是聚灵珠
                            {
                                m_DealCreat.n_UsesItemTick = 0;// 时间初始
                                UserItem->btValue[12] = 2;// 不能聚集的标识
                            }
                            ClearCopyItem(0, UserItem->wIndex, UserItem->MakeIndex);// 清理包裹和仓库复制物品
                            this.AddItemToBag(UserItem);
                            ((this) as TPlayObject).SendAddItem(UserItem);
                            if (StdItem != null)
                            {
                                if (StdItem->NeedIdentify == 1)
                                {
                                    M2Share.AddGameDataLog("8" + "\09" + m_DealCreat.m_sMapName + "\09" + (m_DealCreat.m_nCurrX).ToString()
                                        + "\09" + (m_DealCreat.m_nCurrY).ToString() + "\09" + m_DealCreat.m_sCharName + "\09" + HUtil32.SBytePtrToString(StdItem->Name, StdItem->NameLen)
                                        + "\09" + (UserItem->MakeIndex).ToString() + "\09" + "(" + (HUtil32.LoWord(StdItem->DC)).ToString()
                                        + "/" + (HUtil32.HiWord(StdItem->DC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MC)).ToString()
                                        + "/" + (HUtil32.HiWord(StdItem->MC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->SC)).ToString()
                                        + "/" + (HUtil32.HiWord(StdItem->SC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->AC)).ToString()
                                        + "/" + (HUtil32.HiWord(StdItem->AC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MAC)).ToString()
                                        + "/" + (HUtil32.HiWord(StdItem->MAC)).ToString() + ")" + (UserItem->btValue[0]).ToString() + "/"
                                        + (UserItem->btValue[1]).ToString() + "/" + (UserItem->btValue[2]).ToString() + "/" + (UserItem->btValue[3]).ToString()
                                        + "/" + (UserItem->btValue[4]).ToString() + "/" + (UserItem->btValue[5]).ToString() + "/" + (UserItem->btValue[6]).ToString()
                                        + "/" + (UserItem->btValue[7]).ToString() + "/" + (UserItem->btValue[8]).ToString() + "/" + (UserItem->btValue[14]).ToString()
                                        + "\09" + this.m_sCharName);
                                }
                            }
                        }
                    }
                    if (m_DealCreat.m_nDealGolds > 0)
                    {
                        this.m_nGold += m_DealCreat.m_nDealGolds;
                        this.GoldChanged();
                        if (M2Share.g_boGameLogGold)
                        {
                            M2Share.AddGameDataLog("8" + "\09" + m_DealCreat.m_sMapName + "\09" + (m_DealCreat.m_nCurrX).ToString()
                                + "\09" + (m_DealCreat.m_nCurrY).ToString() + "\09" + m_DealCreat.m_sCharName + "\09" + M2Share.sSTRING_GOLDNAME
                                + "\09" + (m_DealCreat.m_nGold).ToString() + "\09" + "1" + "\09" + this.m_sCharName);
                        }
                    }
                    PlayObject = ((m_DealCreat) as TPlayObject);
                    PlayObject.SendDefMessage(Grobal2.SM_DEALSUCCESS, 0, 0, 0, 0, "");// '交易成功...'
                    PlayObject.SysMsg(GameMsgDef.g_sDealSuccessMsg, TMsgColor.c_Green, TMsgType.t_Hint);
                    PlayObject.m_DealCreat = null;
                    PlayObject.m_boDealing = false;
                    PlayObject.m_DealItemList.Clear();
                    PlayObject.m_nDealGolds = 0;
                    PlayObject.m_boDealOK = false;
                    SendDefMessage(Grobal2.SM_DEALSUCCESS, 0, 0, 0, 0, "");// '交易成功...'
                    this.SysMsg(GameMsgDef.g_sDealSuccessMsg, TMsgColor.c_Green, TMsgType.t_Hint);
                    m_DealCreat = null;
                    m_boDealing = false;
                    m_DealItemList.Clear();
                    m_nDealGolds = 0;
                    m_boDealOK = false;
                }
                else
                {
                    DealCancel();
                }
            }
            else
            {
                this.SysMsg(GameMsgDef.g_sYouDealOKMsg, TMsgColor.c_Green, TMsgType.t_Hint); // '你已经确认交易了'
                m_DealCreat.SysMsg(GameMsgDef.g_sPoseDealOKMsg, TMsgColor.c_Green, TMsgType.t_Hint);// '对方已经确认交易了'
            }
        }

        /// <summary>
        /// 客户端获取小地图
        /// </summary>
        private void ClientGetMinMap()
        {
            int nMinMap = this.m_PEnvir.nMinMap;
            if (nMinMap > 0)
            {
                SendDefMessage(Grobal2.SM_READMINIMAP_OK, 0, (ushort)nMinMap, 0, 0, "");
            }
            else
            {
                SendDefMessage(Grobal2.SM_READMINIMAP_FAIL, 0, 0, 0, 0, "");
            }
        }

        /// <summary>
        /// 客户端取制造的药品
        /// </summary>
        /// <param name="NPC"></param>
        /// <param name="nItemName"></param>
        private void ClientMakeDrugItem(int NPC, string nItemName)
        {
            TMerchant Merchant = UserEngine.FindMerchant(NPC);
            if ((Merchant == null) || (!Merchant.m_boMakeDrug))
            {
                return;
            }
            if (((Merchant.m_PEnvir == this.m_PEnvir) && (Math.Abs(Merchant.m_nCurrX - this.m_nCurrX) < 15) && (Math.Abs(Merchant.m_nCurrY - this.m_nCurrY) < 15)))
            {
                Merchant.ClientMakeDrugItem(this, nItemName);
            }
        }

        /// <summary>
        /// 客户端打开行会对话框
        /// </summary>
        private void ClientOpenGuildDlg()
        {
            string SC;
            if (this.m_MyGuild != null)
            {
                SC = this.m_MyGuild.sGuildName + '\r' + " " + '\r';
                if (this.m_nGuildRankNo == 1)
                {
                    SC = SC + "1" + '\r';
                }
                else
                {
                    SC = SC + "0" + '\r';
                }
                SC = SC + "<Notice>" + '\r';
                if (this.m_MyGuild.NoticeList.Count > 0)
                {
                    for (int I = 0; I < this.m_MyGuild.NoticeList.Count; I++)
                    {
                        if (SC.Length > 5000)
                        {
                            break;
                        }
                        SC = SC + this.m_MyGuild.NoticeList[I] + '\r';
                    }
                }
                SC = SC + "<KillGuilds>" + '\r';
                if (this.m_MyGuild.GuildWarList.Count > 0)
                {
                    for (int I = 0; I < this.m_MyGuild.GuildWarList.Count; I++)
                    {
                        if (SC.Length > 5000)
                        {
                            break;
                        }
                        SC = SC + this.m_MyGuild.GuildWarList[I] + '\r';
                    }
                }
                SC = SC + "<AllyGuilds>" + '\r';
                if (this.m_MyGuild.GuildAllList.Count > 0)
                {
                    for (int I = 0; I < this.m_MyGuild.GuildAllList.Count; I++)
                    {
                        if (SC.Length > 5000)
                        {
                            break;
                        }
                        SC = SC + this.m_MyGuild.GuildAllList[I] + '\r';
                    }
                }
                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_OPENGUILDDLG, 0, 0, 0, 1, 0);
                SendSocket(this.m_DefMsg, EncryptUnit.EncodeString(SC));
            }
            else
            {
                SendDefMessage(Grobal2.SM_OPENGUILDDLG_FAIL, 0, 0, 0, 0, "");
            }
        }

        /// <summary>
        /// 客户端打开行会
        /// </summary>
        private void ClientGuildHome()
        {
            ClientOpenGuildDlg();
        }

        /// <summary>
        /// 客户端获取行会成员列表
        /// </summary>
        private void ClientGuildMemberList()
        {
            TGuildRank GuildRank;
            string sSENDMSG = string.Empty;
            if (this.m_MyGuild == null)
            {
                return;
            }
            if (this.m_MyGuild.m_RankList.Count > 0)
            {
                for (int I = 0; I < this.m_MyGuild.m_RankList.Count; I++)
                {
                    GuildRank = this.m_MyGuild.m_RankList[I];
                    if (GuildRank == null)
                    {
                        continue;
                    }
                    sSENDMSG = sSENDMSG + "#" + GuildRank.nRankNo + "/*" + GuildRank.sRankName + "/";
                    if (GuildRank.MemberList.Count > 0)
                    {
                        for (int II = 0; II < GuildRank.MemberList.Count; II++)
                        {
                            if (sSENDMSG.Length > 5000)
                            {
                                break;
                            }
                            sSENDMSG = sSENDMSG + GuildRank.MemberList[II] + "/";
                        }
                    }
                }
            }
            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SENDGUILDMEMBERLIST, 0, 0, 0, 1, 0);
            SendSocket(this.m_DefMsg, EncryptUnit.EncodeString(sSENDMSG));
        }

        /// <summary>
        /// 客户端行会增加成员
        /// </summary>
        /// <param name="sHumName"></param>
        private void ClientGuildAddMember(string sHumName)
        {
            int result;
            TPlayObject PlayObject;
            result = 1;// '你没有权利使用这个命令。'
            if (this.IsGuildMaster())
            {
                PlayObject = UserEngine.GetPlayObject(sHumName);
                if ((PlayObject != null) && (!PlayObject.m_boNotOnlineAddExp)) //增加检测不是离线挂机人物
                {
                    if ((PlayObject.GetPoseCreate() == this) && (PlayObject.GetPoseCreate() != null))
                    {
                        if (PlayObject.m_boAllowGuild)
                        {
                            if (!this.m_MyGuild.IsMember(sHumName))
                            {
                                if ((PlayObject.m_MyGuild == null) && (this.m_MyGuild.m_RankList.Count < this.m_MyGuild.m_nGuildMemberCount))
                                {
                                    this.m_MyGuild.AddMember(PlayObject);
                                    UserEngine.SendServerGroupMsg(Grobal2.SS_207, M2Share.nServerIndex, this.m_MyGuild.sGuildName);
                                    PlayObject.m_MyGuild = this.m_MyGuild;
                                    PlayObject.m_sGuildRankName = this.m_MyGuild.GetRankName(PlayObject, ref PlayObject.m_nGuildRankNo);
                                    PlayObject.RefShowName();
                                    PlayObject.SysMsg("您已加入行会: " + this.m_MyGuild.sGuildName + " 当前封号为: " +
                                        PlayObject.m_sGuildRankName, TMsgColor.c_Green, TMsgType.t_Hint);
                                    result = 0;
                                }
                                else
                                {
                                    result = 4; // '对方已经加入其他行会。'
                                }
                            }
                            else
                            {
                                result = 3;// '对方已经加入我们的行会。'
                            }
                        }
                        else
                        {
                            result = 5;// '对方不允许加入行会。'
                            PlayObject.SysMsg("您拒绝加入行会。 [允许命令为 @" + M2Share.g_GameCommand.LETGUILD.sCmd + "]", TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                    }
                    else
                    {
                        result = 2;// '想加入行会的应该来面对行会掌门人'
                    }
                }
                else
                {
                    result = 2;
                }
            }
            if (result == 0)
            {
                SendDefMessage(Grobal2.SM_GUILDADDMEMBER_OK, 0, 0, 0, 0, "");
            }
            else
            {
                SendDefMessage(Grobal2.SM_GUILDADDMEMBER_FAIL, result, 0, 0, 0, "");
            }
        }

        /// <summary>
        /// 客户端行会删除成员
        /// </summary>
        /// <param name="sHumName"></param>
        private void ClientGuildDelMember(string sHumName)
        {
            int nC;
            string s14;
            TPlayObject PlayObject;
            nC = 1;
            if (this.IsGuildMaster())
            {
                if (this.m_MyGuild.IsMember(sHumName))
                {
                    if (this.m_sCharName != sHumName)
                    {
                        if (this.m_MyGuild.DelMember(sHumName))
                        {
                            PlayObject = UserEngine.GetPlayObject(sHumName);
                            if (PlayObject != null)
                            {
                                PlayObject.m_MyGuild = null;
                                PlayObject.RefRankInfo(0, "");
                                PlayObject.RefShowName();
                            }
                            UserEngine.SendServerGroupMsg(Grobal2.SS_207, M2Share.nServerIndex, ((TGUild)(this.m_MyGuild)).sGuildName);
                            nC = 0;
                        }
                        else
                        {
                            nC = 4;
                        }
                    }
                    else
                    {
                        nC = 3;
                        s14 = this.m_MyGuild.sGuildName;
                        if (this.m_MyGuild.CancelGuld(sHumName))
                        {
                            GuildManager.DelGuild(s14);
                            UserEngine.SendServerGroupMsg(Grobal2.SS_206, M2Share.nServerIndex, s14);
                            this.m_MyGuild = null;
                            RefRankInfo(0, "");
                            this.RefShowName();
                            this.SysMsg("行会" + s14 + "已被取消！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                            nC = 0;
                        }
                    }
                }
                else
                {
                    nC = 2;
                }
            }
            if (nC == 0)
            {
                SendDefMessage(Grobal2.SM_GUILDDELMEMBER_OK, 0, 0, 0, 0, "");
            }
            else
            {
                SendDefMessage(Grobal2.SM_GUILDDELMEMBER_FAIL, nC, 0, 0, 0, "");
            }
        }

        /// <summary>
        /// 客户端行会更新公告
        /// </summary>
        /// <param name="sNotict"></param>
        private void ClientGuildUpdateNotice(string sNotict)
        {
            string SC = string.Empty;
            if ((this.m_MyGuild == null) || (this.m_nGuildRankNo != 1))
            {
                return;
            }
            this.m_MyGuild.NoticeList.Clear();
            while ((sNotict != ""))
            {
                sNotict = HUtil32.GetValidStr3(sNotict, ref SC, new string[] { "\r" });
                this.m_MyGuild.NoticeList.Add(SC);
            }
            this.m_MyGuild.SaveGuildInfoFile();
            UserEngine.SendServerGroupMsg(Grobal2.SS_207, M2Share.nServerIndex, this.m_MyGuild.sGuildName);
            ClientOpenGuildDlg();
        }

        /// <summary>
        /// 修改行会成员封号,等级
        /// </summary>
        /// <param name="sRankInfo"></param>
        private void ClientGuildUpdateRankInfo(string sRankInfo)
        {
            if ((this.m_MyGuild == null) || (this.m_nGuildRankNo != 1)) // 没有行会或不是行会老大则退出
            {
                return;
            }
            int Rank = this.m_MyGuild.UpdateRank(sRankInfo);
            if (Rank == 0)
            {
                UserEngine.SendServerGroupMsg(Grobal2.SS_207, M2Share.nServerIndex, this.m_MyGuild.sGuildName);
                ClientGuildMemberList();
            }
            else
            {
                if (Rank <= -2)
                {
                    SendDefMessage(Grobal2.SM_GUILDRANKUPDATE_FAIL, Rank, 0, 0, 0, "");
                }
            }
        }

        // 行会联盟
        private void ClientGuildAlly()
        {
            int n8;
            int nCode;
            TBaseObject BaseObjectC;
            const string sExceptionMsg = "{异常} TPlayObject::ClientGuildAlly {0}";
            nCode = 1;
            try
            {
                n8 = -1;
                BaseObjectC = this.GetPoseCreate();
                nCode = 2;
                if ((BaseObjectC != null) && (BaseObjectC.m_MyGuild != null) && (BaseObjectC.m_btRaceServer == Grobal2.RC_PLAYOBJECT) && (BaseObjectC.GetPoseCreate() == this))
                {
                    if (BaseObjectC.m_MyGuild != null && BaseObjectC.m_MyGuild.m_boEnableAuthAlly)
                    {
                        nCode = 3;
                        if (BaseObjectC.IsGuildMaster() && this.IsGuildMaster())
                        {
                            nCode = 4;
                            if (this.m_MyGuild != null && this.m_MyGuild.IsNotWarGuild(BaseObjectC.m_MyGuild) && BaseObjectC.m_MyGuild.IsNotWarGuild(this.m_MyGuild))
                            {
                                nCode = 6;
                                this.m_MyGuild.AllyGuild(BaseObjectC.m_MyGuild);
                                nCode = 7;
                                BaseObjectC.m_MyGuild.AllyGuild(this.m_MyGuild);
                                nCode = 8;
                                this.m_MyGuild.SendGuildMsg(BaseObjectC.m_MyGuild.sGuildName + "行会已经和您的行会联盟成功。");
                                nCode = 9;
                                BaseObjectC.m_MyGuild.SendGuildMsg(this.m_MyGuild.sGuildName + "行会已经和您的行会联盟成功。");
                                nCode = 10;
                                this.m_MyGuild.RefMemberName();
                                nCode = 11;
                                BaseObjectC.m_MyGuild.RefMemberName();
                                nCode = 12;
                                UserEngine.SendServerGroupMsg(Grobal2.SS_207, M2Share.nServerIndex, this.m_MyGuild.sGuildName);
                                nCode = 13;
                                UserEngine.SendServerGroupMsg(Grobal2.SS_207, M2Share.nServerIndex, BaseObjectC.m_MyGuild.sGuildName);
                                nCode = 14;
                                n8 = 0;
                            }
                            else
                            {
                                n8 = -2;
                            }
                        }
                        else
                        {
                            n8 = -3;
                        }
                    }
                    else
                    {
                        n8 = -4;
                    }
                }
                if (n8 == 0)
                {
                    SendDefMessage(Grobal2.SM_GUILDMAKEALLY_OK, 0, 0, 0, 0, "");
                }
                else
                {
                    SendDefMessage(Grobal2.SM_GUILDMAKEALLY_FAIL, n8, 0, 0, 0, "");
                }
            }
            catch
            {
                M2Share.MainOutMessage(string.Format(sExceptionMsg, nCode));
            }
        }

        private void ClientGuildBreakAlly(string sGuildName)
        {
            int n10;
            TGUild Guild;
            if (!this.IsGuildMaster())
            {
                return;
            }
            Guild = GuildManager.FindGuild(sGuildName);
            if ((Guild != null) && (this.m_MyGuild != null))
            {
                if (this.m_MyGuild.IsAllyGuild(Guild))
                {
                    this.m_MyGuild.DelAllyGuild(Guild);
                    Guild.DelAllyGuild(this.m_MyGuild);
                    this.m_MyGuild.SendGuildMsg(Guild.sGuildName + " 行会与您的行会解除联盟成功！！！");
                    Guild.SendGuildMsg(this.m_MyGuild.sGuildName + " 行会解除了与您行会的联盟！！！");
                    this.m_MyGuild.RefMemberName();
                    Guild.RefMemberName();
                    UserEngine.SendServerGroupMsg(Grobal2.SS_207, M2Share.nServerIndex, this.m_MyGuild.sGuildName);
                    UserEngine.SendServerGroupMsg(Grobal2.SS_207, M2Share.nServerIndex, Guild.sGuildName);
                    n10 = 0;
                }
                else
                {
                    n10 = -2;
                }
            }
            else
            {
                n10 = -3;
            }
            if (n10 == 0)
            {
                SendDefMessage(Grobal2.SM_GUILDBREAKALLY_OK, 0, 0, 0, 0, "");
            }
            else
            {
                SendDefMessage(Grobal2.SM_GUILDMAKEALLY_FAIL, 0, 0, 0, 0, "");
            }
        }

        public void RecalcAdjusBonus_AdjustAb(ushort Abil, ushort Val, ref ushort lov, ref ushort hiv)
        {
            byte Lo = 0;
            byte Hi = 0;
            int I;
            //Lo = LoByte(Abil);
            //Hi = HiByte(Abil);
            lov = 0;
            hiv = 0;
            for (I = 1; I <= Val; I++)
            {
                if (Lo + 1 < Hi)
                {
                    Lo++;
                    lov++;
                }
                else
                {
                    Hi++;
                    hiv++;
                }
            }
        }

        // 检查动作状态
        private unsafe void RecalcAdjusBonus()
        {
            TNakedAbility* BonusTick;
            TNakedAbility* NakedAbil;
            int adc;
            int amc;
            int asc;
            int aac;
            int amac;
            ushort ldc = 0;
            ushort lmc = 0;
            ushort lsc = 0;
            ushort lac = 0;
            ushort lmac = 0;
            ushort hdc = 0;
            ushort hmc = 0;
            ushort hsc = 0;
            ushort hac = 0;
            ushort hmac = 0;
            try
            {
                BonusTick = null;
                NakedAbil = null;
                switch (this.m_btJob)
                {
                    case 0:
                        fixed (TNakedAbility* item = &GameConfig.BonusAbilofWarr)
                        {
                            BonusTick = item;
                        }
                        fixed (TNakedAbility* item = &GameConfig.NakedAbilofWarr)
                        {
                            NakedAbil = item;
                        }
                        break;
                    case 1:
                        fixed (TNakedAbility* item = &GameConfig.BonusAbilofWizard)
                        {
                            BonusTick = item;
                        }
                        fixed (TNakedAbility* item = &GameConfig.NakedAbilofWizard)
                        {
                            NakedAbil = item;
                        }
                        break;
                    case 2:
                        fixed (TNakedAbility* item = &GameConfig.BonusAbilofTaos)
                        {
                            BonusTick = item;
                        }
                        fixed (TNakedAbility* item = &GameConfig.NakedAbilofTaos)
                        {
                            NakedAbil = item;
                        }
                        break;
                }
                adc = this.m_BonusAbil.DC / BonusTick->DC;
                amc = this.m_BonusAbil.MC / BonusTick->MC;
                asc = this.m_BonusAbil.SC / BonusTick->SC;
                aac = this.m_BonusAbil.AC / BonusTick->AC;
                amac = this.m_BonusAbil.MAC / BonusTick->MAC;
                RecalcAdjusBonus_AdjustAb(NakedAbil->DC, (ushort)adc, ref ldc, ref hdc);
                RecalcAdjusBonus_AdjustAb(NakedAbil->MC, (ushort)amc, ref lmc, ref hmc);
                RecalcAdjusBonus_AdjustAb(NakedAbil->SC, (ushort)asc, ref lsc, ref hsc);
                RecalcAdjusBonus_AdjustAb(NakedAbil->AC, (ushort)aac, ref lac, ref hac);
                RecalcAdjusBonus_AdjustAb(NakedAbil->MAC, (ushort)amac, ref lmac, ref hmac);
                this.m_WAbil.DC = HUtil32.MakeLong(HUtil32.LoWord(this.m_WAbil.DC) + ldc, HUtil32.HiWord(this.m_WAbil.DC) + hdc);
                this.m_WAbil.MC = HUtil32.MakeLong(HUtil32.LoWord(this.m_WAbil.MC) + lmc, HUtil32.HiWord(this.m_WAbil.MC) + hmc);
                this.m_WAbil.SC = HUtil32.MakeLong(HUtil32.LoWord(this.m_WAbil.SC) + lsc, HUtil32.HiWord(this.m_WAbil.SC) + hsc);
                this.m_WAbil.AC = HUtil32.MakeLong(HUtil32.LoWord(this.m_WAbil.AC) + lac, HUtil32.HiWord(this.m_WAbil.AC) + hac);
                this.m_WAbil.MAC = HUtil32.MakeLong(HUtil32.LoWord(this.m_WAbil.MAC) + lmac, HUtil32.HiWord(this.m_WAbil.MAC) + hmac);
                this.m_WAbil.MaxHP = HUtil32._MIN(Int32.MaxValue, this.m_WAbil.MaxHP + this.m_BonusAbil.HP / BonusTick->HP);// 21亿血
                this.m_WAbil.MaxMP = HUtil32._MIN(Int32.MaxValue, this.m_WAbil.MaxMP + this.m_BonusAbil.MP / BonusTick->MP);
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.RecalcAdjusBonus");
            }
        }

        private void ClientAdjustBonus(int nPoint, string sMsg)
        {
            TNakedAbility BonusAbil;
            int nTotleUsePoint = 0;
            //FillChar(BonusAbil, sizeof(TNakedAbility), '\0');
            //DecodeBuffer(sMsg, BonusAbil, sizeof(TNakedAbility));
            //nTotleUsePoint = BonusAbil.DC + BonusAbil.MC + BonusAbil.SC + BonusAbil.AC + BonusAbil.MAC + BonusAbil.HP + BonusAbil.MP + BonusAbil.Hit + BonusAbil.Speed + BonusAbil.X2;
            if (((nPoint + nTotleUsePoint) == this.m_nBonusPoint) && (this.m_nBonusPoint > 0) && (nPoint >= 0) && (this.m_nBonusPoint >= nPoint))
            {
                if (nTotleUsePoint > 0)
                {
                    BonusAbil = new TNakedAbility();
                    this.m_nBonusPoint = nPoint;
                    this.m_BonusAbil.DC += BonusAbil.DC;
                    this.m_BonusAbil.MC += BonusAbil.MC;
                    this.m_BonusAbil.SC += BonusAbil.SC;
                    this.m_BonusAbil.AC += BonusAbil.AC;
                    this.m_BonusAbil.MAC += BonusAbil.MAC;
                    this.m_BonusAbil.HP += BonusAbil.HP;
                    this.m_BonusAbil.MP += BonusAbil.MP;
                    this.m_BonusAbil.Hit += BonusAbil.Hit;
                    this.m_BonusAbil.Speed += BonusAbil.Speed;
                    this.m_BonusAbil.X2 += BonusAbil.X2;
                    RecalcAbilitys();
                    this.CompareSuitItem(false); //套装与身上装备对比
                    this.SendMsg(this, Grobal2.RM_ABILITY, 0, 0, 0, 0, "");
                    this.SendMsg(this, Grobal2.RM_SUBABILITY, 0, 0, 0, 0, "");
                }
            }
            else
            {
                this.SysMsg("非法数据调整！！！", TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        public int GetMyStatus()
        {
            int result = m_nHungerStatus / 1000;
            if (result > 4)
            {
                result = 4;
            }
            return result;
        }

        private unsafe void SendAdjustBonus()
        {
            string sSENDMSG = "";
            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_ADJUST_BONUS, this.m_nBonusPoint, 0, 0, 0, 0);
            byte[] dataonw = new byte[sizeof(TNakedAbility)];
            byte[] datato = new byte[sizeof(TNakedAbility)];
            byte[] datas = new byte[sizeof(TNakedAbility)];
            switch (this.m_btJob)
            {
                case 0:
                    fixed (byte* pb = dataonw)
                    {
                        *(TNakedAbility*)pb = GameConfig.BonusAbilofWarr;
                    }
                    fixed (byte* pb = datato)
                    {
                        *(TNakedAbility*)pb = this.m_BonusAbil;
                    }
                    fixed (byte* pb = datas)
                    {
                        *(TNakedAbility*)pb = GameConfig.NakedAbilofWarr;
                    }
                    sSENDMSG = EncryptUnit.EncodeBuffer(dataonw, sizeof(TNakedAbility)) + "/" +
                    EncryptUnit.EncodeBuffer(datato, sizeof(TNakedAbility)) + "/" +
                    EncryptUnit.EncodeBuffer(datas, sizeof(TNakedAbility));
                    break;
                case 1:
                    fixed (byte* pb = dataonw)
                    {
                        *(TNakedAbility*)pb = GameConfig.BonusAbilofWizard;
                    }
                    fixed (byte* pb = datato)
                    {
                        *(TNakedAbility*)pb = this.m_BonusAbil;
                    }
                    fixed (byte* pb = datas)
                    {
                        *(TNakedAbility*)pb = GameConfig.NakedAbilofWizard;
                    }
                    sSENDMSG = EncryptUnit.EncodeBuffer(datato, sizeof(TNakedAbility)) + "/" +
                        EncryptUnit.EncodeBuffer(datato, sizeof(TNakedAbility)) + "/" +
                        EncryptUnit.EncodeBuffer(datas, sizeof(TNakedAbility));
                    break;
                case 2:
                    fixed (byte* pb = dataonw)
                    {
                        *(TNakedAbility*)pb = GameConfig.BonusAbilofTaos;
                    }
                    fixed (byte* pb = datato)
                    {
                        *(TNakedAbility*)pb = this.m_BonusAbil;
                    }
                    fixed (byte* pb = datas)
                    {
                        *(TNakedAbility*)pb = GameConfig.NakedAbilofWizard;
                    }
                    sSENDMSG = EncryptUnit.EncodeBuffer(dataonw, sizeof(TNakedAbility)) + "/"
                        + EncryptUnit.EncodeBuffer(datato, sizeof(TNakedAbility)) + "/"
                        + EncryptUnit.EncodeBuffer(datas, sizeof(TNakedAbility));
                    break;
            }
            SendSocket(this.m_DefMsg, sSENDMSG);
        }

        // 鉴定主副将英雄
        public void DelMember(TPlayObject PlayObject)
        {
            if (m_GroupOwner != PlayObject)
            {
                for (int I = m_GroupMembers.Count - 1; I >= 0; I--)
                {
                    if (m_GroupMembers.Count <= 0)
                    {
                        break;
                    }
                    if ((m_GroupMembers[I] != null))
                    {
                        if ((m_GroupMembers[I] == PlayObject))
                        {
                            PlayObject.LeaveGroup();
                            m_GroupMembers.RemoveAt(I);
                            break;
                        }
                    }
                }
            }
            else
            {
                for (int I = m_GroupMembers.Count - 1; I >= 0; I--)
                {
                    if (m_GroupMembers.Count <= 0)
                    {
                        break;
                    }
                    if (m_GroupMembers[I] != null)
                    {
                        m_GroupMembers[I].LeaveGroup();
                        m_GroupMembers.RemoveAt(I);
                    }
                }
            }
            if (!CancelGroup())
            {
                SendDefMessage(Grobal2.SM_GROUPCANCEL, 0, 0, 0, 0, "");
            }
            else
            {
                SendGroupMembers();
            }
        }

        private void ShowMapInfo(string sMAP, string sX, string sY)
        {
            TEnvirnoment Map;
            int nX;
            int nY;
            TMapCellinfo MapCellInfo;
            nX = HUtil32.Str_ToInt(sX, 0);
            nY = HUtil32.Str_ToInt(sY, 0);
            if ((sMAP != "") && (nX >= 0) && (nY >= 0))
            {
                Map = M2Share.g_MapManager.FindMap(sMAP);
                if (Map != null)
                {
                    MapCellInfo = new TMapCellinfo();
                    if (Map.GetMapCellInfo(nX, nY, ref MapCellInfo))
                    {
                        this.SysMsg("标志: " + MapCellInfo.chFlag, TMsgColor.c_Green, TMsgType.t_Hint);
                        if (MapCellInfo.ObjList != null)
                        {
                            this.SysMsg("对象数: " + MapCellInfo.ObjList.Count, TMsgColor.c_Green, TMsgType.t_Hint);
                        }
                    }
                    else
                    {
                        this.SysMsg("取地图单元信息失败: " + sMAP, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                }
            }
            else
            {
                this.SysMsg("请按正确格式输入: " + M2Share.g_GameCommand.MAPINFO.sCmd + " 地图号 X Y", TMsgColor.c_Green, TMsgType.t_Hint);
            }
        }

        /// <summary>
        /// 发送组队聊天信息
        /// </summary>
        /// <param name="sMsg"></param>
        private void SendGroupText(string sMsg)
        {
            TPlayObject PlayObject;
            sMsg = GameConfig.sGroupMsgPreFix + sMsg;
            if (m_GroupOwner != null)
            {
                if (m_GroupOwner.m_GroupMembers.Count > 0)
                {
                    for (int I = 0; I < m_GroupOwner.m_GroupMembers.Count; I++)
                    {
                        PlayObject = m_GroupOwner.m_GroupMembers[I];
                        if (PlayObject == null)
                        {
                            continue;
                        }
                        PlayObject.SendMsg(this, Grobal2.RM_GROUPMESSAGE, 0, GameConfig.btGroupMsgFColor, GameConfig.btGroupMsgBColor, 0, sMsg);
                    }
                }
            }
        }

        /// <summary>
        /// 地图杀怪触发
        /// </summary>
        /// <returns></returns>
        public bool KillMonsterFunc_GotoKillMonsterFunc()
        {
            bool result = false;
            if (M2Share.g_FunctionNPC != null)
            {
                if (this.m_PEnvir != null)
                {
                    if (this.m_PEnvir.m_boKILLFUNC)
                    {
                        M2Share.g_FunctionNPC.GotoLable(this, "@KillMonster" + this.m_PEnvir.m_nKILLFUNC, false);
                    }
                }
                M2Share.g_FunctionNPC.GotoLable(this, "@KillMonster", false);
                result = true;
            }
            return result;
        }

        /// <summary>
        /// 执行杀怪触发
        /// </summary>
        /// <param name="BaseObject"></param>
        /// <returns></returns>
        public bool KillMonsterFunc(TBaseObject BaseObject)
        {
            bool result = false;
            byte nCode = 0;
            try
            {
                if (BaseObject != null)
                {
                    nCode = 1;
                    if (!BaseObject.m_boGhost)
                    {
                        nCode = 2;
                        if (BaseObject.m_btRaceServer >= Grobal2.RC_ANIMAL)
                        {
                            nCode = 3;
                            m_sString[0] = BaseObject.m_sCharName;
                            nCode = 4;
                            m_nInteger[0] = BaseObject.m_Abil.Level;
                            nCode = 5;
                            result = KillMonsterFunc_GotoKillMonsterFunc();
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.KillMonsterFunc Code:" + nCode);
            }
            return result;
        }

        /// <summary>
        /// PK死亡掉经验、升级、掉钱
        /// 由 TBaseObject.Die调用 
        /// </summary>
        /// <param name="PlayObject"></param>
        public void PKDie(TPlayObject PlayObject)
        {
            int nWinLevel;
            int nLostLevel;
            uint nWinExp;
            uint nLostExp;
            bool boWinLEvel;
            bool boLostLevel;
            bool boWinExp;
            bool boLostExp;
            nWinLevel = GameConfig.nKillHumanWinLevel;
            nLostLevel = GameConfig.nKilledLostLevel;
            nWinExp = GameConfig.nKillHumanWinExp;
            nLostExp = GameConfig.nKillHumanLostExp;
            boWinLEvel = GameConfig.boKillHumanWinLevel;
            boLostLevel = GameConfig.boKilledLostLevel;
            boWinExp = GameConfig.boKillHumanWinExp;
            boLostExp = GameConfig.boKilledLostExp;
            if (this.m_PEnvir.m_boPKWINLEVEL)
            {
                boWinLEvel = true;
                nWinLevel = this.m_PEnvir.m_nPKWINLEVEL;
            }
            if (this.m_PEnvir.m_boPKLOSTLEVEL)
            {
                boLostLevel = true;
                nLostLevel = this.m_PEnvir.m_nPKLOSTLEVEL;
            }
            if (this.m_PEnvir.m_boPKWINEXP)
            {
                boWinExp = true;
                nWinExp = this.m_PEnvir.m_nPKWINEXP;
            }
            if (this.m_PEnvir.m_boPKLOSTEXP)
            {
                boLostExp = true;
                nLostExp = this.m_PEnvir.m_nPKLOSTEXP;
            }
            if (PlayObject.m_Abil.Level - this.m_Abil.Level > GameConfig.nHumanLevelDiffer)
            {
                if (!PlayObject.IsGoodKilling(this)) // 100
                {
                    PlayObject.IncPkPoint(GameConfig.nKillHumanAddPKPoint);// '你犯了谋杀罪！！！'
                    PlayObject.SysMsg(GameMsgDef.g_sYouMurderedMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                    if (GameConfig.boUnKnowHum && this.m_LastHiter.IsUsesZhuLi())
                    {
                        //带上斗笠,不显示人的真正名字
                        this.SysMsg(string.Format(GameMsgDef.g_sYouKilledByMsg, "神秘人"), TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    else
                    {
                        this.SysMsg(string.Format(GameMsgDef.g_sYouKilledByMsg, this.m_LastHiter.m_sCharName), TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    PlayObject.AddBodyLuck(-GameConfig.nKillHumanDecLuckPoint);
                    if (this.PKLevel() < 1)
                    {
                        if (HUtil32.Random(GameConfig.nKillHumanWeaponUnlockRate) == 0)
                        {
                            PlayObject.MakeWeaponUnlock();
                        }
                    }
                }
                else
                {
                    // '[你受到正当规则保护。]'
                    PlayObject.SysMsg(GameMsgDef.g_sYouProtectedByLawOfDefense, TMsgColor.c_Green, TMsgType.t_Hint);
                }
                return;
            }
            if (boWinLEvel)
            {
                if (PlayObject.m_Abil.Level + nWinLevel <= M2Share.MAXUPLEVEL)
                {
                    PlayObject.m_Abil.Level += (ushort)nWinLevel;// 人物升级记录日志
                    M2Share.AddGameDataLog("12" + "\09" + PlayObject.m_sMapName + "\09" + (PlayObject.m_Abil.Level).ToString()
                        + "\09" + (PlayObject.m_Abil.Exp).ToString() + "/" + (PlayObject.m_Abil.MaxExp).ToString() + "\09" + this.m_sCharName +
                        "\09" + "0" + "\09" + "0" + "\09" + "1" + "\09" + "PK+");
                }
                else
                {
                    PlayObject.m_Abil.Level = M2Share.MAXUPLEVEL;// 人物升级记录日志
                    M2Share.AddGameDataLog("12" + "\09" + PlayObject.m_sMapName + "\09" + (PlayObject.m_Abil.Level).ToString()
                        + "\09" + (PlayObject.m_Abil.Exp).ToString() + "/" + (PlayObject.m_Abil.MaxExp).ToString() + "\09" + this.m_sCharName
                        + "\09" + "0" + "\09" + "0" + "\09" + "1" + "\09" + "PK+");
                }
                PlayObject.HasLevelUp(PlayObject.m_Abil.Level - nWinLevel);
                if (boLostLevel)
                {
                    if (this.PKLevel() >= 2)
                    {
                        if (this.m_Abil.Level >= nLostLevel * 2)
                        {
                            this.m_Abil.Level -= Convert.ToUInt16(nLostLevel * 2);
                        }
                    }
                    else
                    {
                        if (this.m_Abil.Level >= nLostLevel)
                        {
                            this.m_Abil.Level -= (ushort)nLostLevel;
                        }
                    }
                }
            }
            if (boWinExp)
            {
                PlayObject.WinExp(nWinExp);
                if (boLostExp)
                {
                    if (this.m_Abil.Exp >= nLostExp)
                    {
                        if (this.m_Abil.Exp >= nLostExp)
                        {
                            this.m_Abil.Exp -= nLostExp;
                        }
                        else
                        {
                            this.m_Abil.Exp = 0;
                        }
                    }
                    else
                    {
                        if (this.m_Abil.Level >= 1)
                        {
                            this.m_Abil.Level -= 1;
                            this.m_Abil.Exp += this.GetLevelExp(this.m_Abil.Level);
                            if (this.m_Abil.Exp >= nLostExp)
                            {
                                this.m_Abil.Exp -= nLostExp;
                            }
                            else
                            {
                                this.m_Abil.Exp = 0;
                            }
                        }
                        else
                        {
                            this.m_Abil.Level = 0;
                            this.m_Abil.Exp = 0;
                        }
                        HasLevelUp(m_Abil.Level + 1);
                    }
                }
            }
        }

        /// <summary>
        /// 死亡触发函数
        /// </summary>
        /// <returns></returns>
        public bool DieGotoLable()
        {
            bool result = false;
            byte nCode = 0;
            try
            {
                if ((this.m_LastHiter != null) && (this.m_btRaceServer == Grobal2.RC_PLAYOBJECT))
                {
                    nCode = 1;
                    if (this.m_LastHiter.m_Master != null)
                    {
                        if (this.m_LastHiter.m_Master.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                        {
                            nCode = 2;
                            m_sString[0] = ((this.m_LastHiter.m_Master) as TPlayObject).m_sCharName;
                            m_nInteger[0] = ((this.m_LastHiter.m_Master) as TPlayObject).m_WAbil.Level;
                            ((this.m_LastHiter.m_Master) as TPlayObject).m_sString[0] = this.m_sCharName;
                            ((this.m_LastHiter.m_Master) as TPlayObject).m_nInteger[0] = this.m_WAbil.Level;
                            nCode = 3;
                            ((this.m_LastHiter.m_Master) as TPlayObject).KillPlayFunc();
                        }
                        else if (this.m_LastHiter.m_Master.m_btRaceServer == Grobal2.RC_HEROOBJECT)
                        {
                            if (this.m_LastHiter.m_Master.m_Master != null)
                            {
                                nCode = 4;
                                m_sString[0] = ((this.m_LastHiter.m_Master.m_Master) as TPlayObject).m_sCharName;
                                m_nInteger[0] = ((this.m_LastHiter.m_Master.m_Master) as TPlayObject).m_WAbil.Level;
                                ((this.m_LastHiter.m_Master.m_Master) as TPlayObject).m_sString[0] = this.m_sCharName;
                                ((this.m_LastHiter.m_Master.m_Master) as TPlayObject).m_nInteger[0] = this.m_WAbil.Level;
                                nCode = 5;
                                ((this.m_LastHiter.m_Master.m_Master) as TPlayObject).KillPlayFunc();
                            }
                        }
                    }
                    else if (this.m_LastHiter.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                    {
                        nCode = 6;
                        m_sString[0] = ((this.m_LastHiter) as TPlayObject).m_sCharName;
                        m_nInteger[0] = ((this.m_LastHiter) as TPlayObject).m_WAbil.Level;
                        ((this.m_LastHiter) as TPlayObject).m_sString[0] = this.m_sCharName;
                        ((this.m_LastHiter) as TPlayObject).m_nInteger[0] = this.m_WAbil.Level;
                        nCode = 7;
                        ((this.m_LastHiter) as TPlayObject).KillPlayFunc();
                    }
                    if (this.m_LastHiter.m_btRaceServer != Grobal2.RC_PLAYOBJECT)
                    {
                        nCode = 8;
                        m_sString[0] = this.m_LastHiter.m_sCharName;
                        m_nInteger[0] = this.m_LastHiter.m_WAbil.Level;
                    }
                    nCode = 9;
                    result = DieFunc();// 死亡触发
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.DieGotoLable Code:" + nCode);
            }
            return result;
        }

        /// <summary>
        /// 发送组队消息
        /// </summary>
        private void LeaveGroup()
        {
            const string sExitGropMsg = "{0} 已经退出了本组....";
            SendGroupText(string.Format(sExitGropMsg, this.m_sCharName));
            m_GroupOwner = null;
            this.SendMsg(this, Grobal2.RM_GROUPCANCEL, 0, 0, 0, 0, "");
        }

        /// <summary>
        /// 解散队伍
        /// </summary>
        /// <returns></returns>
        private bool CancelGroup()
        {
            const string sCanceGrop = "您的小组被解散了...";
            bool result = true;
            if (m_GroupMembers.Count <= 1)
            {
                SendGroupText(sCanceGrop);
                m_GroupMembers.Clear();
                m_GroupOwner = null;
                result = false;
            }
            return result;
        }

        public void SendGroupMembers()
        {
            TPlayObject PlayObject;
            string sSENDMSG = "";
            if (m_GroupMembers.Count > 0)
            {
                for (int I = 0; I < m_GroupMembers.Count; I++)
                {
                    PlayObject = m_GroupMembers[I];
                    if (PlayObject != null)
                    {
                        sSENDMSG = sSENDMSG + PlayObject.m_sCharName + "/";
                    }
                }
                for (int I = 0; I < m_GroupMembers.Count; I++)
                {
                    PlayObject = m_GroupMembers[I];
                    if (PlayObject != null)
                    {
                        PlayObject.SendDefMessage(Grobal2.SM_GROUPMEMBERS, 0, 0, 0, 0, sSENDMSG);
                    }
                }
            }
        }

        /// <summary>
        /// 根据魔法ID,取魔法数据
        /// </summary>
        /// <param name="nMagicID"></param>
        /// <returns></returns>
        public unsafe TUserMagic* GetMagicInfo(int nMagicID)
        {
            TUserMagic* result = null;
            TUserMagic* UserMagic;
            if (nMagicID >= 60 && nMagicID <= 65)
            {
                if (m_MyHero != null)
                {
                    result = ((THeroObject)(m_MyHero)).FindTogetherMagic();
                    return result;
                }
            }
            if (this.m_MagicList.Count > 0)
            {
                for (int I = 0; I < this.m_MagicList.Count; I++)
                {
                    UserMagic = (TUserMagic*)this.m_MagicList[I];
                    if (UserMagic->MagicInfo.wMagicId == nMagicID)
                    {
                        result = UserMagic;
                        break;
                    }
                }
            }
            return result;
        }

        /// <summary>
        /// 根据魔法名称,取魔法数据
        /// </summary>
        /// <param name="sMagicName"></param>
        /// <returns></returns>
        public unsafe TUserMagic* GetMagicInfo(string sMagicName)
        {
            TUserMagic* result = null;
            TUserMagic* UserMagic;
            if (this.m_MagicList.Count > 0)
            {
                for (int I = 0; I < this.m_MagicList.Count; I++)
                {
                    UserMagic = (TUserMagic*)this.m_MagicList[I];
                    if (string.Compare(HUtil32.SBytePtrToString(UserMagic->MagicInfo.sMagicName, UserMagic->MagicInfo.MagicNameLen), sMagicName, true) == 0)
                    {
                        result = UserMagic;
                        break;
                    }
                }
            }
            return result;
        }

        /// <summary>
        /// 取技能消耗的MP值
        /// spell-魔法消耗
        /// 修炼等级
        /// 魔法等级
        /// 升级魔法
        /// </summary>
        /// <param name="UserMagic"></param>
        /// <returns></returns>
        public unsafe int GetSpellPoint(TUserMagic* UserMagic)
        {
            return (int)HUtil32.Round((double)UserMagic->MagicInfo.wSpell / (UserMagic->MagicInfo.btTrainLv + 1) * (UserMagic->btLevel + 1)) + UserMagic->MagicInfo.btDefSpell;
        }

        public bool DoMotaebo_CanMotaebo(TBaseObject BaseObject, int nMagicLevel)
        {
            bool result = false;
            int nC;
            if ((this.m_Abil.Level > BaseObject.m_Abil.Level) && (!BaseObject.m_boStickMode))
            {
                nC = this.m_Abil.Level - BaseObject.m_Abil.Level;
                if (HUtil32.Random(20) < ((nMagicLevel * 4) + 6 + nC))
                {
                    if (this.IsProperTarget(BaseObject))
                    {
                        result = true;
                    }
                }
            }
            return result;
        }

        /// <summary>
        /// 野蛮冲撞
        /// </summary>
        /// <param name="nDir"></param>
        /// <param name="nMagicLevel"></param>
        /// <returns></returns>
        private bool DoMotaebo(byte nDir, int nMagicLevel)
        {
            bool result;
            bool bo35;
            int n20;
            int n24;
            int n28;
            TBaseObject PoseCreate;
            TBaseObject BaseObject_30;
            TBaseObject BaseObject_34;
            int nX = 0;
            int nY = 0;
            result = false;
            bo35 = true;
            this.m_btDirection = nDir;
            BaseObject_34 = null;
            n24 = nMagicLevel + 1;
            n28 = n24;
            PoseCreate = this.GetPoseCreate();
            if (PoseCreate != null)
            {
                for (int I = 0; I <= HUtil32._MAX(2, nMagicLevel + 1); I++)
                {
                    PoseCreate = this.GetPoseCreate();
                    if (PoseCreate != null)
                    {
                        n28 = 0;
                        if (!DoMotaebo_CanMotaebo(PoseCreate, nMagicLevel))// 判断对面第一个角色是否可撞
                        {
                            break;
                        }
                        if (nMagicLevel >= 3)// 技能大于3级判断对面第二个角色是否可撞 
                        {
                            if (this.m_PEnvir.GetNextPosition(this.m_nCurrX, this.m_nCurrY, this.m_btDirection, 2, ref nX, ref nY))
                            {
                                BaseObject_30 = this.m_PEnvir.GetMovingObject(nX, nY, true);
                                if ((BaseObject_30 != null) && DoMotaebo_CanMotaebo(BaseObject_30, nMagicLevel))
                                {
                                    BaseObject_30.CharPushed(this.m_btDirection, 1);
                                }
                            }
                        }
                        BaseObject_34 = PoseCreate;
                        if (PoseCreate.CharPushed(this.m_btDirection, 1) != 1)
                        {
                            break;
                        }
                        this.GetFrontPosition(ref nX, ref nY);
                        if (this.m_PEnvir.MoveToMovingObject(this.m_nCurrX, this.m_nCurrY, this, nX, nY, false) > 0)
                        {
                            this.m_nCurrX = nX;
                            this.m_nCurrY = nY;
                            this.SendRefMsg(Grobal2.RM_RUSH, nDir, this.m_nCurrX, this.m_nCurrY, 0, "");
                            bo35 = false;
                            result = true;
                        }
                        n24 -= 1;
                    }
                }
            }
            else
            {
                bo35 = false;
                for (int I = 0; I <= HUtil32._MAX(2, nMagicLevel + 1); I++)
                {
                    this.GetFrontPosition(ref nX, ref nY);
                    if (this.m_PEnvir.MoveToMovingObject(this.m_nCurrX, this.m_nCurrY, this, nX, nY, false) > 0)
                    {
                        this.m_nCurrX = nX;
                        this.m_nCurrY = nY;
                        this.SendRefMsg(Grobal2.RM_RUSH, nDir, this.m_nCurrX, this.m_nCurrY, 0, "");
                        n28 -= 1;
                    }
                    else
                    {
                        if (this.m_PEnvir.CanWalk(nX, nY, true))
                        {
                            n28 = 0;
                        }
                        else
                        {
                            bo35 = true;
                            break;
                        }
                    }
                }
            }
            if ((BaseObject_34 != null))
            {
                if (n24 < 0)
                {
                    n24 = 0;
                }
                n20 = HUtil32.Random((n24 + 1) * 10) + ((n24 + 1) * 10);
                n20 = BaseObject_34.GetHitStruckDamage(this, n20);
                BaseObject_34.StruckDamage(n20);
                BaseObject_34.SendRefMsg(Grobal2.RM_STRUCK, n20, BaseObject_34.m_WAbil.HP, BaseObject_34.m_WAbil.MaxHP, this.ToInt(), "");
                if (BaseObject_34.m_btRaceServer != Grobal2.RC_PLAYOBJECT)
                {
                    BaseObject_34.SendMsg(BaseObject_34, Grobal2.RM_STRUCK, n20, BaseObject_34.m_WAbil.HP, BaseObject_34.m_WAbil.MaxHP, this.ToInt(), "");
                }
            }
            if (bo35)
            {
                this.GetFrontPosition(ref nX, ref nY);
                this.SendRefMsg(Grobal2.RM_RUSHKUNG, this.m_btDirection, nX, nY, 0, "");// 冲撞力不够！！！
                this.SysMsg(GameMsgDef.sMateDoTooweak, TMsgColor.c_Red, TMsgType.t_Hint);
            }
            if (n28 > 0)
            {
                if (n24 < 0)
                {
                    n24 = 0;
                }
                n20 = HUtil32.Random(n24 * 10) + ((n24 + 1) * 3);
                n20 = this.GetHitStruckDamage(this, n20);
                this.StruckDamage(n20);
                this.SendRefMsg(Grobal2.RM_STRUCK, n20, this.m_WAbil.HP, this.m_WAbil.MaxHP, 0, "");
            }
            return result;
        }

        public bool DoZXMotaebo_CanMotaebo(TBaseObject BaseObject, int nMagicLevel)
        {
            bool result = false;
            int nC;
            if ((this.m_Abil.Level > BaseObject.m_Abil.Level) && (!BaseObject.m_boStickMode))
            {
                nC = this.m_Abil.Level - BaseObject.m_Abil.Level;
                if (HUtil32.Random(20) < ((nMagicLevel * 4) + 6 + nC))
                {
                    if (this.IsProperTarget(BaseObject))
                    {
                        result = true;
                    }
                }
            }
            return result;
        }

        // 追心刺 顶5步
        public ushort DoZXMotaebo(byte nDir, int nMagicLevel)
        {
            ushort result;
            bool bo35;
            int n20;
            int n24;
            int n28;
            TBaseObject PoseCreate;
            TBaseObject BaseObject_30;
            TBaseObject BaseObject_34;
            int nX = 0;
            int nY = 0;
            result = 0;
            bo35 = true;
            this.m_btDirection = nDir;
            BaseObject_34 = null;
            n24 = nMagicLevel + 1;
            n28 = n24;
            PoseCreate = this.GetPoseCreate();
            if (PoseCreate != null)
            {
                for (int I = 0; I <= 4; I++)// 推5步
                {
                    PoseCreate = this.GetPoseCreate();
                    if (PoseCreate != null)
                    {
                        n28 = 0;
                        if (!DoZXMotaebo_CanMotaebo(PoseCreate, nMagicLevel))// 判断对面第一个角色是否可撞 
                        {
                            break;
                        }
                        if (nMagicLevel >= 3)// 技能大于3级判断对面第二个角色是否可撞
                        {
                            if (this.m_PEnvir.GetNextPosition(this.m_nCurrX, this.m_nCurrY, this.m_btDirection, 2, ref nX, ref nY))
                            {
                                BaseObject_30 = this.m_PEnvir.GetMovingObject(nX, nY, true);
                                if ((BaseObject_30 != null) && DoZXMotaebo_CanMotaebo(BaseObject_30, nMagicLevel))
                                {
                                    BaseObject_30.CharPushedEx(this.m_btDirection, 1);
                                }
                            }
                        }
                        BaseObject_34 = PoseCreate;
                        if (PoseCreate.CharPushedEx(this.m_btDirection, 1) != 1)
                        {
                            break;
                        }
                        this.GetFrontPosition(ref nX, ref nY);
                        if (this.m_PEnvir.MoveToMovingObject(this.m_nCurrX, this.m_nCurrY, this, nX, nY, false) > 0)
                        {
                            this.m_nCurrX = nX;
                            this.m_nCurrY = nY;
                            bo35 = false;
                        }
                        n24 -= 1;
                        result++;
                    }
                }
            }
            else
            {
                bo35 = false;
                for (int I = 0; I <= 4; I++)
                {
                    this.GetFrontPosition(ref nX, ref nY);
                    if (this.m_PEnvir.MoveToMovingObject(this.m_nCurrX, this.m_nCurrY, this, nX, nY, false) > 0)
                    {
                        this.m_nCurrX = nX;
                        this.m_nCurrY = nY;
                        n28 -= 1;
                    }
                    else
                    {
                        if (this.m_PEnvir.CanWalk(nX, nY, true))
                        {
                            n28 = 0;
                        }
                        else
                        {
                            bo35 = true;
                            break;
                        }
                    }
                }
            }
            unsafe
            {
                HUtil32.ZeroMemory((IntPtr)this.m_nBatterZhuiXin.Defmsg, (IntPtr)sizeof(TDefaultMessage));
                //ZeroMemory(this.m_nBatterZhuiXin.defmsg, sizeof(TDefaultMessage));
                if ((BaseObject_34 != null))
                {
                    this.m_nBatterZhuiXin.Defmsg->Recog = BaseObject_34.ToInt();
                    this.m_nBatterZhuiXin.Defmsg->Ident = Grobal2.SM_BATTERBACKSTEP;
                    this.m_nBatterZhuiXin.Defmsg->Param = (UInt16)BaseObject_34.m_nCurrX;
                    this.m_nBatterZhuiXin.Defmsg->Tag = (UInt16)BaseObject_34.m_nCurrY;
                    this.m_nBatterZhuiXin.Defmsg->Series = BaseObject_34.m_btDirection;
                    this.m_nBatterZhuiXin.Defmsg->nSessionID = result;
                    this.m_nBatterZhuiXin.desc.feature = BaseObject_34.GetFeature(this);
                    this.m_nBatterZhuiXin.desc.Status = BaseObject_34.m_nCharStatus;
                    this.SendMsg(BaseObject_34, Grobal2.RM_PUSHEX, BaseObject_34.m_btDirection, BaseObject_34.m_nCurrX, BaseObject_34.m_nCurrY, result, "");
                }
            }
            if ((BaseObject_34 != null))
            {
                if (n24 < 0)
                {
                    n24 = 0;
                }
                n20 = HUtil32.Random((n24 + 1) * 10) + ((n24 + 1) * 10);
                n20 = BaseObject_34.GetHitStruckDamage(this, n20);
                BaseObject_34.StruckDamage(n20);
                BaseObject_34.SendRefMsg(Grobal2.RM_STRUCK, n20, BaseObject_34.m_WAbil.HP, BaseObject_34.m_WAbil.MaxHP, this.ToInt(), "");
                if (BaseObject_34.m_btRaceServer != Grobal2.RC_PLAYOBJECT)
                {
                    BaseObject_34.SendMsg(BaseObject_34, Grobal2.RM_STRUCK, n20, BaseObject_34.m_WAbil.HP, BaseObject_34.m_WAbil.MaxHP, this.ToInt(), "");
                }
            }
            return result;
        }

        /// <summary>
        /// 发送攻击模式
        /// </summary>
        public void SendAttatckMode()
        {
            switch (this.m_btAttatckMode)//攻击模式
            {
                case M2Share.HAM_ALL:// [攻击模式: 全体攻击]
                    this.SendMsg(this, Grobal2.RM_CHANGEATTATCKMODE, 0, 0, 0, 0, GameMsgDef.sAttackModeOfAll);
                    this.SysMsg(GameMsgDef.sAttackModeOfAll, TMsgColor.c_Green, TMsgType.t_Hint);
                    break;
                case M2Share.HAM_PEACE:// [攻击模式: 和平攻击]
                    this.SendMsg(this, Grobal2.RM_CHANGEATTATCKMODE, 0, 0, 0, 0, GameMsgDef.sAttackModeOfPeaceful);
                    this.SysMsg(GameMsgDef.sAttackModeOfPeaceful, TMsgColor.c_Green, TMsgType.t_Hint);
                    break;
                case M2Share.HAM_DEAR:// [攻击模式: 夫妻攻击]
                    this.SendMsg(this, Grobal2.RM_CHANGEATTATCKMODE, 0, 0, 0, 0, GameMsgDef.sAttackModeOfDear);
                    this.SysMsg(GameMsgDef.sAttackModeOfDear, TMsgColor.c_Green, TMsgType.t_Hint);
                    break;
                case M2Share.HAM_MASTER: // [攻击模式: 师徒攻击]
                    this.SendMsg(this, Grobal2.RM_CHANGEATTATCKMODE, 0, 0, 0, 0, GameMsgDef.sAttackModeOfMaster);
                    this.SysMsg(GameMsgDef.sAttackModeOfMaster, TMsgColor.c_Green, TMsgType.t_Hint);
                    break;
                case M2Share.HAM_GROUP: // [攻击模式: 编组攻击]
                    this.SendMsg(this, Grobal2.RM_CHANGEATTATCKMODE, 0, 0, 0, 0, GameMsgDef.sAttackModeOfGroup);
                    this.SysMsg(GameMsgDef.sAttackModeOfGroup, TMsgColor.c_Green, TMsgType.t_Hint);
                    break;
                case M2Share.HAM_GUILD: // [攻击模式: 行会攻击]
                    this.SendMsg(this, Grobal2.RM_CHANGEATTATCKMODE, 0, 0, 0, 0, GameMsgDef.sAttackModeOfGuild);
                    this.SysMsg(GameMsgDef.sAttackModeOfGuild, TMsgColor.c_Green, TMsgType.t_Hint);
                    break;
                case M2Share.HAM_PKATTACK:  // [攻击模式: 红名攻击]
                    this.SendMsg(this, Grobal2.RM_CHANGEATTATCKMODE, 0, 0, 0, 0, GameMsgDef.sAttackModeOfRedWhite);
                    this.SysMsg(GameMsgDef.sAttackModeOfRedWhite, TMsgColor.c_Green, TMsgType.t_Hint);
                    break;
            }
        }
            
        /// <summary>
        /// 使用魔法
        /// </summary>
        /// <param name="UserMagic"></param>
        /// <param name="nTargetX"></param>
        /// <param name="nTargetY"></param>
        /// <param name="BaseObject"></param>
        /// <returns></returns>
        public unsafe bool DoSpell(TUserMagic* UserMagic, int nTargetX, int nTargetY, TBaseObject BaseObject)
        {
            bool result = false;
            int nSpellPoint;
            try
            {
                if (!MagicManager.IsWarrSkill(UserMagic->wMagIdx))
                {
                    nSpellPoint = GetSpellPoint(UserMagic);
                    if ((nSpellPoint > 0) && (UserMagic->wMagIdx != MagicConst.SKILL_68) && (UserMagic->wMagIdx != MagicConst.SKILL_50)
                        && (UserMagic->wMagIdx != MagicConst.SKILL_77) && (UserMagic->wMagIdx != MagicConst.SKILL_78) &&
                        (UserMagic->wMagIdx != MagicConst.SKILL_80) && (UserMagic->wMagIdx != MagicConst.SKILL_81) &&
                        (UserMagic->wMagIdx != MagicConst.SKILL_83) && (UserMagic->wMagIdx != MagicConst.SKILL_84) &&
                        (UserMagic->wMagIdx != MagicConst.SKILL_86) && (UserMagic->wMagIdx != MagicConst.SKILL_87))
                    {
                        // 酒气护体,无极真气不在此处减MP  连击不减MP
                        if (this.m_WAbil.MP < nSpellPoint)
                        {
                            return result;
                        }
                        this.DamageSpell(nSpellPoint);
                        this.HealthSpellChanged();
                    }
                    if (m_boTrainingNG) //学过内功心法,每攻击一次减一点内力值
                    {
                        m_Skill69NH = (ushort)HUtil32._MAX(0, m_Skill69NH - GameConfig.nHitStruckDecNH);
                        this.SendRefMsg(Grobal2.RM_MAGIC69SKILLNH, 0, m_Skill69NH, m_Skill69MaxNH, 0, "");
                    }
                    result = MagicManager.DoSpell(this, UserMagic, nTargetX, nTargetY, BaseObject);
                }
            }
            catch
            {
                M2Share.MainOutMessage(string.Format("{异常} TPlayObject.DoSpell MagID:{0} X:{1] Y:{2}", UserMagic->wMagIdx, nTargetX, nTargetY));
            }
            return result;
        }

        /// <summary>
        /// 挖矿
        /// </summary>
        /// <param name="nX"></param>
        /// <param name="nY"></param>
        /// <returns></returns>
        private bool PileStones(int nX, int nY)
        {
            bool result = false;
            TEvent __Event;
            TEvent PileEvent;
            string s1C = "";
            __Event = this.m_PEnvir.GetEvent(nX, nY);
            if ((__Event != null))
            {
                if ((__Event.m_nEventType == M2Share.ET_STONEMINE))
                {
                    if (((TStoneMineEvent)(__Event)).m_nMineCount > 0)
                    {
                        ((TStoneMineEvent)(__Event)).m_nMineCount -= 1;
                        if (HUtil32.Random(GameConfig.nMakeMineHitRate) == 0)
                        {
                            PileEvent = this.m_PEnvir.GetEvent(this.m_nCurrX, this.m_nCurrY);
                            if (PileEvent == null)
                            {
                                PileEvent = new TPileStones(this.m_PEnvir, this.m_nCurrX, this.m_nCurrY, Grobal2.ET_PILESTONES, 300000); // 5 * 60 * 1000
                                M2Share.g_EventManager.AddEvent(PileEvent);
                            }
                            else
                            {
                                if (PileEvent.m_nEventType == Grobal2.ET_PILESTONES)
                                {
                                    ((TPileStones)(PileEvent)).AddEventParam();
                                }
                            }
                            if (HUtil32.Random(GameConfig.nMakeMineRate) == 0)
                            {
                                MakeMine();
                            }
                            s1C = "1";
                            this.DoDamageWeapon(HUtil32.Random(15) + 5);
                            result = true;
                        }
                    }
                    else
                    {
                        if ((HUtil32.GetTickCount() - ((TStoneMineEvent)(__Event)).m_dwAddStoneMineTick) > 600000)// 10 * 60 * 1000
                        {
                            ((TStoneMineEvent)(__Event)).AddStoneMine();
                        }
                    }
                }
            }
            this.SendRefMsg(Grobal2.RM_HEAVYHIT, this.m_btDirection, this.m_nCurrX, this.m_nCurrY, 0, s1C);
            return result;
        }

        /// <summary>
        /// 发送保存到普通仓库的物品
        /// </summary>
        /// <param name="nBaseObject"></param>
        private unsafe void SendSaveItemList(int nBaseObject)
        {
            TStdItem* Item;
            string sSENDMSG = "";
            TClientItem* ClientItem = null;
            TOClientItem* OClientItem = null;
            TStdItem* StdItem = null;
            TUserItem* UserItem;
            string sUserItemName;
            if (m_nSoftVersionDateEx == 0)
            {
                if (m_StorageItemList.Count > 0)
                {
                    for (int I = 0; I < m_StorageItemList.Count; I++)
                    {
                        UserItem = (TUserItem*)m_StorageItemList[I];
                        Item = UserEngine.GetStdItem(UserItem->wIndex);
                        if (Item != null)
                        {
                            StdItem = Item;
                            ItemUnit.GetItemAddValue(UserItem, StdItem);
                            M2Share.CopyStdItemToOStdItem(StdItem, &OClientItem->s);// 取自定义物品名称
                            sUserItemName = "";
                            if (UserItem->btValue[13] == 1)
                            {
                                sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                            }
                            if (sUserItemName != "")
                            {
                                HUtil32.StrToSByteArry(sUserItemName, OClientItem->s.Name, 14, ref OClientItem->s.NameLen);
                                //OClientItem->s->Name = sUserItemName;
                            }
                            OClientItem->Dura = UserItem->Dura;
                            OClientItem->DuraMax = UserItem->DuraMax;
                            OClientItem->MakeIndex = UserItem->MakeIndex;
                            byte[] data = new byte[sizeof(TOClientItem)];
                            fixed (byte* pb = data)
                            {
                                *(TOClientItem*)pb = *OClientItem;
                            }
                            sSENDMSG = sSENDMSG + EncryptUnit.EncodeBuffer(data, sizeof(TOClientItem)) + "/";
                        }
                    }
                }
                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SAVEITEMLIST, nBaseObject, 0, 0, m_StorageItemList.Count, 0);
                SendSocket(this.m_DefMsg, sSENDMSG);
            }
            else
            {
                sSENDMSG = "";
                if (m_StorageItemList.Count > 0)
                {
                    for (int I = 0; I < m_StorageItemList.Count; I++)
                    {
                        UserItem = (TUserItem*)m_StorageItemList[I];
                        Item = UserEngine.GetStdItem(UserItem->wIndex);
                        if (Item != null)
                        {
                            StdItem = Item;
                            ItemUnit.GetItemAddValue(UserItem, StdItem);
                            ClientItem = (TClientItem*)Marshal.AllocHGlobal(sizeof(TClientItem));//Dr.Kevin 修复此处没有申请内存地址BUG
                            ClientItem->s = *StdItem;
                            sUserItemName = ""; // 取自定义物品名称
                            if (UserItem->btValue[13] == 1)
                            {
                                sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                            }
                            if (sUserItemName != "")
                            {
                                HUtil32.StrToSByteArry(sUserItemName, ClientItem->s.Name, 14, ref ClientItem->s.NameLen);
                                //ClientItem->s->Name = sUserItemName;
                            }
                            if (UserItem->btValue[12] == 1) // 物品发光
                            {
                                ClientItem->s.Reserved1 = 1;
                            }
                            else
                            {
                                ClientItem->s.Reserved1 = 0;
                            }
                            if ((StdItem->StdMode == 60) && (StdItem->Shape != 0))// 酒类,除烧酒外
                            {
                                if (UserItem->btValue[0] != 0)
                                {
                                    ClientItem->s.AC = UserItem->btValue[0]; // 酒的品质
                                }
                                if (UserItem->btValue[1] != 0)
                                {
                                    ClientItem->s.MAC = UserItem->btValue[1];// 酒的酒精度
                                }
                            }
                            if (StdItem->StdMode == 8)// 酿酒材料
                            {
                                if (UserItem->btValue[0] != 0)
                                {
                                    ClientItem->s.AC = UserItem->btValue[0]; // 材料的品质
                                }
                            }
                            ClientItem->Dura = UserItem->Dura;
                            ClientItem->DuraMax = UserItem->DuraMax;
                            ClientItem->MakeIndex = UserItem->MakeIndex;
                            byte[] data = new byte[sizeof(TClientItem)];
                            fixed (byte* pb = data)
                            {
                                *(TClientItem*)pb = *ClientItem;
                            }
                            sSENDMSG = sSENDMSG + EncryptUnit.EncodeBuffer(data, sizeof(TClientItem)) + "/";
                        }
                    }
                }
                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SAVEITEMLIST, nBaseObject, 0, 0, m_StorageItemList.Count, 0);
                SendSocket(this.m_DefMsg, sSENDMSG);
            }
        }

        // 发送保存到无限仓库的物品
        public int SendSaveBigStorageItemList_GetPageCount(int nListCount)
        {
            int result = 0;
            if (nListCount > 0)
            {
                result = nListCount / 50;
                if ((nListCount % 50) > 0)
                {
                    result++;
                }
            }
            return result;
        }

        /// <summary>
        /// 发送仓库物品
        /// </summary>
        /// <param name="nBaseObject"></param>
        /// <param name="nPage"></param>
        private unsafe void SendSaveBigStorageItemList(int nBaseObject, int nPage)
        {
            TStdItem* Item;
            string sSENDMSG;
            TClientItem* ClientItem = null;
            TOClientItem* OClientItem = null;
            TStdItem* StdItem = null;
            string sUserItemName = string.Empty;
            TBigStorage BigStorage = null;
            int nCount;
            int nIndex;
            if (m_nSoftVersionDateEx == 0)
            {
                sSENDMSG = "";
                nCount = 0;
                nIndex = 0;
                if (m_BigStorageItemList != null)
                {
                    if (nPage == 0)
                    {
                        nIndex = 0;
                    }
                    if (nPage > 0)
                    {
                        nIndex = nPage * 50;
                    }
                    if (nIndex > m_BigStorageItemList.Count - 1)
                    {
                        m_nBigStoragePage = SendSaveBigStorageItemList_GetPageCount(m_BigStorageItemList.Count);
                        return;
                    }
                    for (int I = nIndex; I < m_BigStorageItemList.Count; I++)
                    {
                        BigStorage = m_BigStorageItemList[I];
                        Item = UserEngine.GetStdItem(BigStorage.UseItems.wIndex);
                        if (Item != null)
                        {
                            nCount++;
                            StdItem = Item;
                            fixed (TUserItem* item = &BigStorage.UseItems)
                            {
                                ItemUnit.GetItemAddValue(item, StdItem);
                                M2Share.CopyStdItemToOStdItem(StdItem, &OClientItem->s);// 取自定义物品名称
                                sUserItemName = "";
                                if (item->btValue[13] == 1)
                                {
                                    sUserItemName = ItemUnit.GetCustomItemName(BigStorage.UseItems.MakeIndex, BigStorage.UseItems.wIndex);
                                }
                                if (sUserItemName != "")
                                {
                                    HUtil32.StrToSByteArry(sUserItemName, OClientItem->s.Name, 14, ref OClientItem->s.NameLen);
                                }
                            }
                            OClientItem->Dura = BigStorage.UseItems.Dura;
                            OClientItem->DuraMax = BigStorage.UseItems.DuraMax;
                            OClientItem->MakeIndex = BigStorage.UseItems.MakeIndex;
                            byte[] data = new byte[sizeof(TOClientItem)];
                            fixed (byte* pb = data)
                            {
                                *(TOClientItem*)pb = *OClientItem;
                            }
                            sSENDMSG = sSENDMSG + EncryptUnit.EncodeBuffer(data, sizeof(TOClientItem)) + "/";
                            if (nCount >= 50)
                            {
                                break;
                            }
                        }
                    }
                }
                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SAVEITEMLIST, nBaseObject, 0, 0, nCount, 0);
                SendSocket(this.m_DefMsg, sSENDMSG);
            }
            else
            {
                sSENDMSG = "";
                nCount = 0;
                nIndex = 0;
                if (m_BigStorageItemList != null)
                {
                    if (nPage == 0)
                    {
                        nIndex = 0;
                    }
                    if (nPage > 0)
                    {
                        nIndex = nPage * 50;
                    }
                    if (nIndex > m_BigStorageItemList.Count - 1)
                    {
                        m_nBigStoragePage = SendSaveBigStorageItemList_GetPageCount(m_BigStorageItemList.Count);
                        return;
                    }
                    for (int I = nIndex; I < m_BigStorageItemList.Count; I++)
                    {
                        BigStorage = m_BigStorageItemList[I];
                        Item = UserEngine.GetStdItem(BigStorage.UseItems.wIndex);
                        if (Item != null)
                        {
                            nCount++;
                            StdItem = Item;
                            fixed (TUserItem* item = &BigStorage.UseItems)
                            {
                                ItemUnit.GetItemAddValue(item, StdItem);
                                ClientItem = (TClientItem*)Marshal.AllocHGlobal(sizeof(TClientItem));//Dr.Kevin 修复此处没有申请内存地址BUG
                                ClientItem->s = *StdItem;
                                sUserItemName = ""; // 取自定义物品名称
                                if (item->btValue[13] == 1)
                                {
                                    sUserItemName = ItemUnit.GetCustomItemName(BigStorage.UseItems.MakeIndex, BigStorage.UseItems.wIndex);
                                }
                                if (sUserItemName != "")
                                {
                                    HUtil32.StrToSByteArry(sUserItemName, ClientItem->s.Name, 14, ref ClientItem->s.NameLen);
                                }
                                if (item->btValue[12] == 1)// 物品发光
                                {
                                    ClientItem->s.Reserved1 = 1;
                                }
                                else
                                {
                                    ClientItem->s.Reserved1 = 0;
                                }
                                if ((StdItem->StdMode == 60) && (StdItem->Shape != 0))// 酒类,除烧酒外
                                {
                                    if (item->btValue[0] != 0)
                                    {
                                        ClientItem->s.AC = item->btValue[0];  // 酒的品质
                                    }
                                    if (item->btValue[1] != 0)
                                    {
                                        ClientItem->s.MAC = item->btValue[1];// 酒的酒精度
                                    }
                                }
                                if (StdItem->StdMode == 8) // 酿酒材料
                                {
                                    if (item->btValue[0] != 0)
                                    {
                                        ClientItem->s.AC = item->btValue[0];// 材料的品质
                                    }
                                }
                            }
                            ClientItem->Dura = BigStorage.UseItems.Dura;
                            ClientItem->DuraMax = BigStorage.UseItems.DuraMax;
                            ClientItem->MakeIndex = BigStorage.UseItems.MakeIndex;
                            byte[] data = new byte[sizeof(TClientItem)];
                            fixed (byte* pb = data)
                            {
                                *(TClientItem*)pb = *ClientItem;
                            }
                            sSENDMSG = sSENDMSG + EncryptUnit.EncodeBuffer(data, sizeof(TClientItem)) + "/";
                            if (nCount >= 50)
                            {
                                break;
                            }
                        }
                    }
                }
                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_SAVEITEMLIST, nBaseObject, 0, 0, nCount, 0);
                SendSocket(this.m_DefMsg, sSENDMSG);
            }
        }

        // 发送调整的奖金
        private void SendChangeGuildName()
        {
            if (this.m_MyGuild != null)
            {
                SendDefMessage(Grobal2.SM_CHANGEGUILDNAME, 0, 0, 0, 0, this.m_MyGuild.sGuildName + "/" + this.m_sGuildRankName);
            }
            else
            {
                SendDefMessage(Grobal2.SM_CHANGEGUILDNAME, 0, 0, 0, 0, "");
            }
        }

        /// <summary>
        /// 发送删除物品列表
        /// </summary>
        /// <param name="ItemList"></param>
        private void SendDelItemList(List<string> ItemList)
        {
            string s10 = "";
            if (ItemList.Count > 0)
            {
                for (int I = 0; I < ItemList.Count; I++)
                {
                    s10 = s10 + ItemList[I] + "/" + ItemList[I] + "/";
                }
            }
            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_DELITEMS, 0, 0, 0, ItemList.Count, 0);
            SendSocket(this.m_DefMsg, EncryptUnit.EncodeString(s10));
        }

        /// <summary>
        /// 发送删除物品
        /// </summary>
        /// <param name="UserItem"></param>
        public unsafe virtual void SendDelItems(TUserItem* UserItem)
        {
            TStdItem* StdItem = null;
            TStdItem* StdItem80 = null;
            TClientItem* ClientItem = null;
            TOClientItem* OClientItem = null;
            string sUserItemName;
            if ((m_nSoftVersionDateEx == 0) && (m_dwClientTick == 0))
            {
                StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                if (StdItem != null)
                {
                    StdItem80 = StdItem;
                    ItemUnit.GetItemAddValue(UserItem, StdItem80);
                    M2Share.CopyStdItemToOStdItem(StdItem80, &OClientItem->s);// 取自定义物品名称
                    sUserItemName = "";
                    if (UserItem->btValue[13] == 1)
                    {
                        sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                    }
                    if (sUserItemName != "")
                    {
                        HUtil32.StrToSByteArry(sUserItemName, OClientItem->s.Name, 14, ref OClientItem->s.NameLen);
                    }
                    OClientItem->MakeIndex = UserItem->MakeIndex;
                    OClientItem->Dura = UserItem->Dura;
                    OClientItem->DuraMax = UserItem->DuraMax;
                    this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_DELITEM, HUtil32.ObjectToInt(this), 0, 0, 1, 0);
                    byte[] data = new byte[sizeof(TOClientItem)];
                    fixed (byte* pb = data)
                    {
                        *(TOClientItem*)pb = *OClientItem;
                    }
                    SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TOClientItem)));
                }
            }
            else
            {
                StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                if (StdItem != null)
                {
                    StdItem80 = StdItem;
                    ItemUnit.GetItemAddValue(UserItem, StdItem80);
                    ClientItem = (TClientItem*)Marshal.AllocHGlobal(sizeof(TClientItem));//Dr.Kevin 修复此处没有申请内存地址BUG
                    ClientItem->s = *StdItem80;
                    sUserItemName = "";// 取自定义物品名称
                    if (UserItem->btValue[13] == 1)
                    {
                        sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                    }
                    if (sUserItemName != "")
                    {
                        HUtil32.StrToSByteArry(sUserItemName, ClientItem->s.Name, 14, ref ClientItem->s.NameLen);
                    }
                    if (UserItem->btValue[12] == 1) // 物品发光
                    {
                        ClientItem->s.Reserved1 = 1;
                    }
                    else
                    {
                        ClientItem->s.Reserved1 = 0;
                    }
                    if ((StdItem->StdMode == 60) && (StdItem->Shape != 0))// 酒类,除烧酒外
                    {
                        if (UserItem->btValue[0] != 0)
                        {
                            ClientItem->s.AC = UserItem->btValue[0];// 酒的品质
                        }
                        if (UserItem->btValue[1] != 0)
                        {
                            ClientItem->s.MAC = UserItem->btValue[1]; // 酒的酒精度
                        }
                    }
                    ClientItem->MakeIndex = UserItem->MakeIndex;
                    ClientItem->Dura = UserItem->Dura;
                    ClientItem->DuraMax = UserItem->DuraMax;
                    byte[] data = new byte[sizeof(TClientItem)];
                    fixed (byte* pb = data)
                    {
                        *(TClientItem*)pb = *ClientItem;
                    }
                    this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_DELITEM, HUtil32.ObjectToInt(this), 0, 0, 1, 0);
                    SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TClientItem)));
                }
            }
        }

        /// <summary>
        /// 发送更新物品
        /// </summary>
        /// <param name="UserItem"></param>
        public unsafe void SendUpdateItem(TUserItem* UserItem)
        {
            TStdItem* StdItem;
            TStdItem* StdItem80;
            TClientItem* ClientItem = null;
            TOClientItem* OClientItem = null;
            string sUserItemName;
            if ((m_nSoftVersionDateEx == 0) && (m_dwClientTick == 0))
            {
                StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                if (StdItem != null)
                {
                    StdItem80 = StdItem;
                    ItemUnit.GetItemAddValue(UserItem, StdItem80);
                    M2Share.CopyStdItemToOStdItem(StdItem80, &OClientItem->s);// 取自定义物品名称
                    sUserItemName = "";
                    if (UserItem->btValue[13] == 1)
                    {
                        sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                    }
                    if (sUserItemName != "")
                    {
                        HUtil32.StrToSByteArry(sUserItemName, OClientItem->s.Name, 14, ref OClientItem->s.NameLen);
                    }
                    OClientItem->MakeIndex = UserItem->MakeIndex;
                    OClientItem->Dura = UserItem->Dura;
                    OClientItem->DuraMax = UserItem->DuraMax;
                    this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_UPDATEITEM, HUtil32.ObjectToInt(this), 0, 0, 1, 0);
                    byte[] data = new byte[sizeof(TOClientItem)];
                    fixed (byte* pb = data)
                    {
                        *(TOClientItem*)pb = *OClientItem;
                    }
                    SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TOClientItem)));
                }
            }
            else
            {
                StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                if (StdItem != null)
                {
                    StdItem80 = StdItem;
                    ItemUnit.GetItemAddValue(UserItem, StdItem80);
                    ClientItem = (TClientItem*)Marshal.AllocHGlobal(sizeof(TClientItem));//Dr.Kevin 修复此处没有申请内存地址BUG
                    ClientItem->s = *StdItem80;// 取自定义物品名称
                    sUserItemName = "";
                    if (UserItem->btValue[13] == 1)
                    {
                        sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                    }
                    if (sUserItemName != "")
                    {
                        HUtil32.StrToSByteArry(sUserItemName, ClientItem->s.Name, 14, ref ClientItem->s.NameLen);
                        //ClientItem->s->Name = sUserItemName;
                    }
                    if (UserItem->btValue[12] == 1)// 物品发光
                    {
                        ClientItem->s.Reserved1 = 1;
                    }
                    else
                    {
                        ClientItem->s.Reserved1 = 0;
                    }
                    if ((StdItem->StdMode == 60) && (StdItem->Shape != 0))// 酒类,除烧酒外
                    {
                        if (UserItem->btValue[0] != 0)
                        {
                            ClientItem->s.AC = UserItem->btValue[0]; // 酒的品质
                        }
                        if (UserItem->btValue[1] != 0)
                        {
                            ClientItem->s.MAC = UserItem->btValue[1];// 酒的酒精度
                        }
                    }
                    ClientItem->MakeIndex = UserItem->MakeIndex;
                    ClientItem->Dura = UserItem->Dura;
                    ClientItem->DuraMax = UserItem->DuraMax;
                    this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_UPDATEITEM, HUtil32.ObjectToInt(this), 0, 0, 1, 0);
                    byte[] data = new byte[sizeof(TClientItem)];
                    fixed (byte* pb = data)
                    {
                        *(TClientItem*)pb = *ClientItem;
                    }
                    SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TClientItem)));
                }
            }
        }

        /// <summary>
        /// 检查装备是否可以穿上身
        /// </summary>
        /// <param name="nWhere"></param>
        /// <param name="StdItem"></param>
        /// <returns></returns>
        private unsafe bool CheckTakeOnItems(int nWhere, TStdItem* StdItem)
        {
            bool result = false;
            TUserCastle Castle;
            if ((StdItem->StdMode == 10) && (this.m_btGender != 0))
            {
                this.SysMsg(GameMsgDef.sWearNotOfWoMan, TMsgColor.c_Red, TMsgType.t_Hint);
                return result;
            }
            if ((StdItem->StdMode == 11) && (this.m_btGender != 1))
            {
                this.SysMsg(GameMsgDef.sWearNotOfMan, TMsgColor.c_Red, TMsgType.t_Hint);
                return result;
            }
            if ((nWhere == 1) || (nWhere == 2))
            {
                if (StdItem->Weight > this.m_WAbil.MaxHandWeight)
                {
                    this.SysMsg(GameMsgDef.sHandWeightNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    return result;
                }
            }
            else
            {
                if ((StdItem->Weight + GetUserItemWeitht(nWhere)) > this.m_WAbil.MaxWearWeight)
                {
                    this.SysMsg(GameMsgDef.sWearWeightNot, TMsgColor.c_Red, TMsgType.t_Hint);// 负重不足
                    return result;
                }
            }
            Castle = M2Share.g_CastleManager.IsCastleMember(this);
            switch (StdItem->Need)
            {
                case 34:
                case 0:// 等级
                    if (this.m_Abil.Level >= StdItem->NeedLevel)
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sLevelNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 35:
                case 1:// 攻击力
                    if (HUtil32.HiWord(this.m_WAbil.DC) >= StdItem->NeedLevel)
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sDCNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 10:// 职业+等级
                    if ((this.m_btJob == HUtil32.LoWord(StdItem->NeedLevel)) && (this.m_Abil.Level >= HUtil32.HiWord(StdItem->NeedLevel)))
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sJobOrLevelNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 11:// 职业+攻击力
                    if ((this.m_btJob == HUtil32.LoWord(StdItem->NeedLevel)) && (HUtil32.HiWord(this.m_WAbil.DC) >= HUtil32.HiWord(StdItem->NeedLevel)))
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sJobOrDCNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 12:// 职业+魔法力
                    if ((this.m_btJob == HUtil32.LoWord(StdItem->NeedLevel)) && (HUtil32.HiWord(this.m_WAbil.MC) >= HUtil32.HiWord(StdItem->NeedLevel)))
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sJobOrMCNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 13:// 职业+道术
                    if ((this.m_btJob == HUtil32.LoWord(StdItem->NeedLevel)) && (HUtil32.HiWord(this.m_WAbil.SC) >= HUtil32.HiWord(StdItem->NeedLevel)))
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sJobOrSCNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 18:// Need=18(表示穿戴需等级，装备可提高内力恢复速度) NeedLevel=50(等级条件) Stock=3(提高内力恢复速度)
                    if (this.m_Abil.Level >= StdItem->NeedLevel)
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sLevelNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 19:// Need=19(表示穿戴需攻击力，装备可提高内力恢复速度%) NeedLevel=50(攻击力条件) Stock=3(提高内力恢复速度%)
                    if ((HUtil32.HiWord(this.m_WAbil.DC) >= HUtil32.HiWord(StdItem->NeedLevel)))
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sDCNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 20:// Need=20(表示穿戴需魔法，装备可提高内力恢复速度%) NeedLevel=50(魔法条件) Stock=3(提高内力恢复速度%)
                    if ((HUtil32.HiWord(this.m_WAbil.MC) >= HUtil32.HiWord(StdItem->NeedLevel)))
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sMCNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 21:// Need=21(表示穿戴需道术，装备可提高内力恢复速度%) NeedLevel=50(道术条件) Stock=3(提高内力恢复速度%)
                    if ((HUtil32.HiWord(this.m_WAbil.SC) >= HUtil32.HiWord(StdItem->NeedLevel)))
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sSCNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 22:// Need=22(表示穿戴需等级，装备可提高内力恢复速度+点) NeedLevel=50(等级条件) Stock=3(每次可提高内力值)
                    if (this.m_Abil.Level >= StdItem->NeedLevel)
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sLevelNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 23:// Need=23(表示穿戴需攻击力，装备可提高内力恢复速度+点) NeedLevel=50(攻击力条件) Stock=3(每次可提高内力值)
                    if ((HUtil32.HiWord(this.m_WAbil.DC) >= HUtil32.HiWord(StdItem->NeedLevel)))
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sDCNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 24:// Need=24(表示穿戴需魔法，装备可提高内力恢复速度+点) NeedLevel=50(魔法条件) Stock=3(每次可提高内力值)
                    if ((HUtil32.HiWord(this.m_WAbil.MC) >= HUtil32.HiWord(StdItem->NeedLevel)))
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sMCNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 25:// Need=25(表示穿戴需道术，装备可提高内力恢复速度+点) NeedLevel=50(道术条件) Stock=3(每次可提高内力值)
                    if ((HUtil32.HiWord(this.m_WAbil.SC) >= HUtil32.HiWord(StdItem->NeedLevel)))
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sSCNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 26:
                    // ======物品支持防爆属性设置=============//
                    // Need-(26)需等级，Stock-为防爆点 NeedLevel-所需等级
                    if (this.m_Abil.Level >= StdItem->NeedLevel)
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sLevelNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 27:// Need-(27)需攻击力，Stock-为防爆点 NeedLevel-所需攻击力
                    if ((HUtil32.HiWord(this.m_WAbil.DC) >= HUtil32.HiWord(StdItem->NeedLevel)))
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sDCNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 28:// Need-(28)需魔法，Stock-为防爆点 NeedLevel-所需魔法
                    if ((HUtil32.HiWord(this.m_WAbil.MC) >= HUtil32.HiWord(StdItem->NeedLevel)))
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sMCNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 29:// Need-(29)需道术，Stock-为防爆点 NeedLevel-所需道术
                    if ((HUtil32.HiWord(this.m_WAbil.SC) >= HUtil32.HiWord(StdItem->NeedLevel)))
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sSCNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 30:
                    // ===========穿戴有吸血属性 Need==============//
                    // Need-(30)需等级，Stock-为吸血点 NeedLevel-所需等级  Reserved-成功机率
                    if (this.m_Abil.Level >= StdItem->NeedLevel)
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sLevelNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 31:// Need-(31)需攻击力，Stock-为吸血点 NeedLevel-所需攻击力  Reserved-成功机率
                    if ((HUtil32.HiWord(this.m_WAbil.DC) >= HUtil32.HiWord(StdItem->NeedLevel)))
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sDCNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 32:// Need-(32)需魔法，Stock-为吸血点 NeedLevel-所需魔法  Reserved-成功机率
                    if ((HUtil32.HiWord(this.m_WAbil.MC) >= HUtil32.HiWord(StdItem->NeedLevel)))
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sMCNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 33:// Need-(33)需道术，Stock-为吸血点 NeedLevel-所需道术  Reserved-成功机率
                    if ((HUtil32.HiWord(this.m_WAbil.SC) >= HUtil32.HiWord(StdItem->NeedLevel)))
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sSCNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 36:
                case 2:// 魔法力
                    if (HUtil32.HiWord(this.m_WAbil.MC) >= StdItem->NeedLevel)
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sMCNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 37:
                case 3:// 道术
                    if (HUtil32.HiWord(this.m_WAbil.SC) >= StdItem->NeedLevel)
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sSCNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 4:// 转生等级
                    if (m_btReLevel >= StdItem->NeedLevel)
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sReNewLevelNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 40:// 转生等级+等级
                    if (m_btReLevel >= HUtil32.LoWord(StdItem->NeedLevel))
                    {
                        if (this.m_Abil.Level >= HUtil32.HiWord(StdItem->NeedLevel))
                        {
                            result = true;
                        }
                        else
                        {
                            this.SysMsg(GameMsgDef.g_sLevelNot, TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sReNewLevelNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 41:// 转生等级+攻击力
                    if (m_btReLevel >= HUtil32.LoWord(StdItem->NeedLevel))
                    {
                        if (HUtil32.HiWord(this.m_WAbil.DC) >= HUtil32.HiWord(StdItem->NeedLevel))
                        {
                            result = true;
                        }
                        else
                        {
                            this.SysMsg(GameMsgDef.g_sDCNot, TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sReNewLevelNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 42:// 转生等级+魔法
                    if (m_btReLevel >= HUtil32.LoWord(StdItem->NeedLevel))
                    {
                        if (HUtil32.HiWord(this.m_WAbil.MC) >= HUtil32.HiWord(StdItem->NeedLevel))
                        {
                            result = true;
                        }
                        else
                        {
                            this.SysMsg(GameMsgDef.g_sMCNot, TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sReNewLevelNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 43:// 转生等级
                    if (m_btReLevel >= HUtil32.LoWord(StdItem->NeedLevel))
                    {
                        if (HUtil32.HiWord(this.m_WAbil.SC) >= HUtil32.HiWord(StdItem->NeedLevel))
                        {
                            result = true;
                        }
                        else
                        {
                            this.SysMsg(GameMsgDef.g_sSCNot, TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sReNewLevelNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 44:// 所需声望和转生等级
                    if (m_btReLevel >= HUtil32.LoWord(StdItem->NeedLevel))
                    {

                        if (m_btCreditPoint >= HUtil32.HiWord(StdItem->NeedLevel))
                        {
                            result = true;
                        }
                        else
                        {
                            this.SysMsg(GameMsgDef.g_sCreditPointNot, TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sReNewLevelNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 5:// 所需声望
                    if (m_btCreditPoint >= StdItem->NeedLevel)
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sCreditPointNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 6:// 行会物品
                    if ((this.m_MyGuild != null))
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sGuildNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 60:// 行会掌门物品
                    if ((this.m_MyGuild != null) && (this.m_nGuildRankNo == 1))
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sGuildMasterNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 7:// 沙城成员物品
                    if ((this.m_MyGuild != null) && (Castle != null))
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sSabukHumanNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 70:// 沙城城主物品
                    if ((this.m_MyGuild != null) && (Castle != null) && (this.m_nGuildRankNo == 1))
                    {
                        if (this.m_Abil.Level >= StdItem->NeedLevel)
                        {
                            result = true;
                        }
                        else
                        {
                            this.SysMsg(GameMsgDef.g_sLevelNot, TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sSabukMasterManNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 8:// 会员物品
                    if (m_nMemberType != 0)
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sMemberNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 81:// 指定类型的会员物品
                    if ((m_nMemberType == HUtil32.LoWord(StdItem->NeedLevel)) && (m_nMemberLevel >= HUtil32.HiWord(StdItem->NeedLevel)))
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sMemberTypeNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
                case 82:// 指定类型的会员物品
                    if ((m_nMemberType >= HUtil32.LoWord(StdItem->NeedLevel)) && (m_nMemberLevel >= HUtil32.HiWord(StdItem->NeedLevel)))
                    {
                        result = true;
                    }
                    else
                    {
                        this.SysMsg(GameMsgDef.g_sMemberTypeNot, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    break;
            }
            return result;
        }

        /// <summary>
        /// 取装备物品的重量
        /// </summary>
        /// <param name="nWhere"></param>
        /// <returns></returns>
        private unsafe int GetUserItemWeitht(int nWhere)
        {
            int result;
            int n14 = 0;
            TStdItem* StdItem;
            for (int I = m_UseItems.GetLowerBound(0); I <= m_UseItems.GetUpperBound(0); I++)
            {
                if ((nWhere == -1) || (!(I == nWhere) && !(I == 1) && !(I == 2)))
                {
                    StdItem = UserEngine.GetStdItem(this.m_UseItems[I]->wIndex);
                    if (StdItem != null)
                    {
                        n14 += StdItem->Weight;
                    }
                }
            }
            result = n14;
            return result;
        }

        /// <summary>
        /// 使用物品
        /// </summary>
        /// <param name="StdItem"></param>
        /// <returns></returns>
        private unsafe bool EatItems(TStdItem* StdItem)
        {
            bool result = false;
            bool bo06;
            int nOldStatus;
            uint dwExp;
            if (this.m_PEnvir.m_boNODRUG)
            {
                this.SysMsg(GameMsgDef.sCanotUseDrugOnThisMap, TMsgColor.c_Red, TMsgType.t_Hint);
                return result;
            }
            switch (StdItem->StdMode)
            {
                case 0:
                    switch (StdItem->Shape)
                    {
                        case 1:
                            this.IncHealthSpell(StdItem->AC, StdItem->MAC);
                            result = true;
                            break;
                        case 2:
                            this.m_boUserUnLockDurg = true;
                            result = true;
                            break;
                        case 3:// 增加内功经验物品
                            if (m_boTrainingNG)
                            {
                                dwExp = Convert.ToUInt32(StdItem->AC * 1000 + Math.Abs(HUtil32.Round(StdItem->AC * m_NGLevel * 3.92)));// 每级加的内功经验不同
                                GetNGExp(dwExp, 1);
                                result = true;
                            }
                            break;
                        default:
                            if ((StdItem->AC > 0))
                            {
                                this.m_nIncHealth += StdItem->AC;
                            }
                            if ((StdItem->MAC > 0))
                            {
                                this.m_nIncSpell += StdItem->MAC;
                            }
                            result = true;
                            break;
                    }
                    break;
                case 1:
                    nOldStatus = GetMyStatus();
                    m_nHungerStatus += (int)StdItem->DuraMax / 10;
                    m_nHungerStatus = HUtil32._MIN(5000, m_nHungerStatus);
                    if (nOldStatus != GetMyStatus())
                    {
                        RefMyStatus();
                    }
                    result = true;
                    break;
                case 2:
                    result = true;
                    break;
                case 3:
                    if (StdItem->Shape == 12)
                    {
                        bo06 = false;
                        if (HUtil32.LoWord(StdItem->DC) > 0)
                        {
                            this.m_wStatusArrValue[0] = (ushort)HUtil32.LoWord(StdItem->DC);
                            this.m_dwStatusArrTimeOutTick[0] = Convert.ToUInt32(HUtil32.GetTickCount() + HUtil32.HiWord(StdItem->MAC) * 1000);
                            this.SysMsg("攻击力增加" + (HUtil32.HiWord(StdItem->MAC)).ToString() + "秒", TMsgColor.c_Green, TMsgType.t_Hint);
                            bo06 = true;
                        }
                        if (HUtil32.LoWord(StdItem->MC) > 0)
                        {
                            this.m_wStatusArrValue[1] = (ushort)HUtil32.LoWord(StdItem->MC);
                            this.m_dwStatusArrTimeOutTick[1] = Convert.ToUInt32(HUtil32.GetTickCount() + HUtil32.HiWord(StdItem->MAC) * 1000);
                            this.SysMsg("魔法力增加" + (HUtil32.HiWord(StdItem->MAC)).ToString() + "秒", TMsgColor.c_Green, TMsgType.t_Hint);
                            bo06 = true;
                        }
                        if ((byte)(StdItem->SC) > 0)
                        {
                            this.m_wStatusArrValue[2] = (ushort)HUtil32.LoWord(StdItem->SC);
                            this.m_dwStatusArrTimeOutTick[2] = Convert.ToUInt32(HUtil32.GetTickCount() + HUtil32.HiWord(StdItem->MAC) * 1000);
                            this.SysMsg("道术增加" + (HUtil32.HiWord(StdItem->MAC)).ToString() + "秒", TMsgColor.c_Green, TMsgType.t_Hint);
                            bo06 = true;
                        }
                        if (HUtil32.HiWord(StdItem->AC) > 0)
                        {
                            this.m_wStatusArrValue[3] = (ushort)HUtil32.HiWord(StdItem->AC);
                            this.m_dwStatusArrTimeOutTick[3] = Convert.ToUInt32(HUtil32.GetTickCount() + HUtil32.HiWord(StdItem->MAC) * 1000);
                            this.SysMsg("攻击速度增加" + (HUtil32.HiWord(StdItem->MAC)).ToString() + "秒", TMsgColor.c_Green, TMsgType.t_Hint);
                            bo06 = true;
                        }
                        if (HUtil32.LoWord(StdItem->AC) > 0)
                        {
                            this.m_wStatusArrValue[4] = (ushort)HUtil32.LoWord(StdItem->AC);
                            this.m_dwStatusArrTimeOutTick[4] = Convert.ToUInt32(HUtil32.GetTickCount() + HUtil32.HiWord(StdItem->MAC) * 1000);
                            this.SysMsg("生命值增加" + (HUtil32.HiWord(StdItem->MAC)).ToString() + "秒", TMsgColor.c_Green, TMsgType.t_Hint);
                            bo06 = true;
                        }
                        if (HUtil32.LoWord(StdItem->MAC) > 0)
                        {
                            this.m_wStatusArrValue[5] = (ushort)HUtil32.LoWord(StdItem->MAC);
                            this.m_dwStatusArrTimeOutTick[5] = Convert.ToUInt32(HUtil32.GetTickCount() + HUtil32.HiWord(StdItem->MAC) * 1000);
                            this.SysMsg("魔法值增加" + (HUtil32.HiWord(StdItem->MAC)).ToString() + "秒", TMsgColor.c_Green, TMsgType.t_Hint);
                            bo06 = true;
                        }
                        if (bo06)
                        {
                            RecalcAbilitys();
                            this.CompareSuitItem(false);// 套装与身上装备对比
                            this.SendMsg(this, Grobal2.RM_ABILITY, 0, 0, 0, 0, "");
                            result = true;
                        }
                    }
                    else
                    {
                        result = EatUseItems(StdItem->Shape);
                    }
                    break;
            }
            return result;
        }

        /// <summary>
        /// 学习技能书
        /// </summary>
        /// <param name="StdItem"></param>
        /// <returns></returns>
        private unsafe bool ReadBook(TStdItem* StdItem)
        {
            bool result = false;
            TMagic* Magic;
            TUserMagic* UserMagic = null;
            byte btOldKey;
            if (!(new ArrayList(new int[] { 13, 26, 45, 88, 89, 91 }).Contains(StdItem->NeedLevel)))
            {
                Magic = UserEngine.FindMagic(HUtil32.SBytePtrToString(StdItem->Name, StdItem->NameLen));
                if (Magic != null)
                {
                    if (!this.IsTrainingSkill(Magic->wMagicId))  // 护体神盾不限制职业
                    {

                        if (((HUtil32.SBytePtrToString(Magic->sDescr, 0, Magic->DescrLen) == "") || (HUtil32.SBytePtrToString(Magic->sDescr, 0, Magic->DescrLen) == "内功") ||
                            (HUtil32.SBytePtrToString(Magic->sDescr, 0, Magic->DescrLen) == "连击")) && ((Magic->btJob == 99) || (Magic->btJob == this.m_btJob) || (Magic->wMagicId == 75)))
                        {
                            if ((HUtil32.SBytePtrToString(Magic->sDescr, 0, Magic->DescrLen) == "内功") || (HUtil32.SBytePtrToString(Magic->sDescr, 0, Magic->DescrLen) == "连击"))// 内功技能
                            {
                                if (m_boTrainingNG)// 学过内功心法才能学习技能
                                {
                                    if (m_NGLevel >= Magic->TrainLevel[0])// 等级达到最低要求
                                    {
                                        UserMagic = (TUserMagic*)Marshal.AllocHGlobal(sizeof(TUserMagic));
                                        UserMagic->MagicInfo = *Magic;
                                        UserMagic->wMagIdx = Magic->wMagicId;
                                        UserMagic->btKey = 0;
                                        UserMagic->btLevel = 0;
                                        UserMagic->nTranPoint = 0;
                                        this.m_MagicList.Add((IntPtr)UserMagic);
                                        AddSkillFunc(Magic->wMagicId);// 人物学技能触发
                                        RecalcAbilitys();
                                        this.CompareSuitItem(false);// 套装与身上装备对比
                                        SendAddMagic(UserMagic);
                                        result = true;
                                        if ((HUtil32.SBytePtrToString(Magic->sDescr, 0, Magic->DescrLen) == "连击"))
                                        {
                                            this.m_boCanUseBatter = true;
                                        }
                                    }
                                    else
                                    {
                                        this.SysMsg(string.Format("您的内功心法等级没有达到 {0},不能学习此内功技能！！！", Magic->TrainLevel[0]), TMsgColor.c_Red, TMsgType.t_Hint);
                                    }
                                }
                                else
                                {
                                    this.SysMsg("您没学过内功心法,不能学习此内功技能！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                                }
                            }
                            else
                            {
                                if (this.m_Abil.Level >= Magic->TrainLevel[0]) // 普通技能
                                {
                                    if ((Magic->wMagicId == 68) && ((m_MaxExp68 != 0) || (m_Exp68 != 0)))// 是酒气护体
                                    {
                                        m_MaxExp68 = 0;
                                        m_Exp68 = 0;
                                    }
                                    UserMagic = (TUserMagic*)Marshal.AllocHGlobal(sizeof(TUserMagic));
                                    UserMagic->MagicInfo = *Magic;
                                    UserMagic->wMagIdx = Magic->wMagicId;
                                    UserMagic->btKey = 0;
                                    UserMagic->btLevel = 0;
                                    UserMagic->nTranPoint = 0;
                                    this.m_MagicList.Add((IntPtr)UserMagic);
                                    AddSkillFunc(Magic->wMagicId);// 人物学技能触发
                                    RecalcAbilitys();
                                    this.CompareSuitItem(false);// 套装与身上装备对比
                                    if ((this.m_MagicBanwolSkill != null) && (Magic->wMagicId == 25)) // 开启半月
                                    {
                                        if (!this.m_boUseHalfMoon)
                                        {
                                            this.HalfMoonOnOff(true);
                                            SendSocket(null, "+WID");
                                        }
                                    }
                                    if ((this.m_MagicErgumSkill != null) && (Magic->wMagicId == 12))// 开启刺杀
                                    {
                                        if (!this.m_boUseThrusting)
                                        {
                                            this.ThrustingOnOff(true);
                                            SendSocket(null, "+LNG");
                                        }
                                    }
                                    if ((this.m_MagicSkill_89 != null) && (Magic->wMagicId == 89))// 开启四级刺杀
                                    {
                                        if (!this.m_boUseThrusting)
                                        {
                                            this.ThrustingOnOff(true);
                                            SendSocket(null, "+4LNG");
                                        }
                                    }
                                    SendAddMagic(UserMagic);
                                    result = true;
                                }
                            }
                        }
                        else
                        {
                            this.SysMsg("您的职业不能学习此技能！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                    }
                    else
                    {
                        this.SysMsg("已经学过此技能,不能再学习！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                }
            }
            else
            {
                Magic = UserEngine.FindMagic(StdItem->NeedLevel);
                if (this.m_Abil.Level >= Magic->TrainLevel[0])
                {
                    if ((Magic != null) && (StdItem->AC == 0))
                    {
                        for (int I = this.m_MagicList.Count - 1; I >= 0; I--)
                        {
                            if (this.m_MagicList.Count <= 0)
                            {
                                break;
                            }
                            UserMagic = (TUserMagic*)this.m_MagicList[I];
                            if (UserMagic != null)
                            {
                                if (((new ArrayList(new int[] { 26, 45, 13 }).Contains(UserMagic->wMagIdx)) && (UserMagic->btLevel < 4)) || (UserMagic->wMagIdx != StdItem->NeedLevel))
                                {
                                    if (UserMagic->MagicInfo.wMagicId == StdItem->Need)
                                    {
                                        ((this) as TPlayObject).SendDelMagic(UserMagic);
                                        btOldKey = UserMagic->btKey;// 保存快捷键
                                        Marshal.FreeHGlobal((IntPtr)UserMagic);
                                        this.m_MagicList.RemoveAt(I);
                                        UserMagic->MagicInfo = *Magic;
                                        UserMagic->wMagIdx = Magic->wMagicId;
                                        UserMagic->btKey = btOldKey;
                                        UserMagic->btLevel = 4;
                                        UserMagic->nTranPoint = 0;
                                        this.m_MagicList.Add((IntPtr)UserMagic);
                                        this.SendAddMagic(UserMagic);
                                        //((this) as TPlayObject).SendAddMagic(UserMagic);
                                        AddSkillFunc(Magic->wMagicId);// 人物学技能触发 
                                        RecalcAbilitys();
                                        this.CompareSuitItem(false);// 套装与身上装备对比
                                        if ((this.m_MagicSkill_89 != null) && (Magic->wMagicId == 89)) // 开启四级刺杀
                                        {
                                            if (!this.m_boUseThrusting)
                                            {
                                                this.ThrustingOnOff(true);
                                                SendSocket(null, "+4LNG");
                                            }
                                        }
                                        result = true;
                                        break;
                                    }
                                }
                                else
                                {
                                    this.SysMsg("已经学过此技能,不能再学习！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                                }
                            }
                        }
                    }
                    else
                    {
                        this.SysMsg("您不能学习英雄的技能！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                }
                else
                {
                    this.SysMsg("您不能学习此技能！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                }
            }
            return result;
        }

        /// <summary>
        /// 发送增加魔法
        /// </summary>
        /// <param name="UserMagic"></param>
        public unsafe void SendAddMagic(TUserMagic* UserMagic)
        {
            TClientMagic ClientMagic = new TClientMagic();
            ClientMagic.Key = ((char)UserMagic->btKey);
            ClientMagic.Level = UserMagic->btLevel;
            ClientMagic.CurTrain = UserMagic->nTranPoint;
            ClientMagic.Def = UserMagic->MagicInfo;
            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_ADDMAGIC, 0, 0, 0, 1, 0);
            SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer<TClientMagic>(ClientMagic));
        }

        /// <summary>
        /// 删除删除魔法
        /// </summary>
        /// <param name="UserMagic"></param>
        public unsafe void SendDelMagic(TUserMagic* UserMagic)
        {
            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_DELMAGIC, UserMagic->wMagIdx, 0, 0, 1, 0);
            SendSocket(this.m_DefMsg, "");
        }

        /// <summary>
        /// 使用物品
        /// </summary>
        /// <param name="nShape"></param>
        /// <returns></returns>
        private bool EatUseItems(int nShape)
        {
            bool result = false;
            TUserCastle Castle;
            switch (nShape)
            {
                case 1:
                    this.SendRefMsg(Grobal2.RM_SPACEMOVE_FIRE, 0, 0, 0, 0, "");
                    BaseObjectMove(this.m_sHomeMap, "", "");
                    result = true;
                    break;
                case 2:// 随机传送卷
                    if (!this.m_PEnvir.m_boNORANDOMMOVE)
                    {
                        this.SendRefMsg(Grobal2.RM_SPACEMOVE_FIRE, 0, 0, 0, 0, "");
                        BaseObjectMove(this.m_sMapName, "", "");
                        result = true;
                    }
                    break;
                case 3://回城卷
                    this.SendRefMsg(Grobal2.RM_SPACEMOVE_FIRE, 0, 0, 0, 0, "");
                    if (this.PKLevel() < 2) //PK值小于200则飞回安全区，否则飞回红名村
                    {
                        BaseObjectMove(this.m_sHomeMap, this.m_nHomeX.ToString(), this.m_nHomeY.ToString());
                    }
                    else
                    {
                        BaseObjectMove(GameConfig.sRedHomeMap, GameConfig.nRedHomeX.ToString(), GameConfig.nRedHomeY.ToString());
                    }
                    result = true;
                    break;
                case 4://祝福语
                    if (WeaptonMakeLuck())
                    {
                        result = true;
                    }
                    break;
                case 5://行会回城卷
                    if (this.m_MyGuild != null)
                    {
                        if (!this.m_boInFreePKArea)
                        {
                            Castle = M2Share.g_CastleManager.IsCastleMember(this);
                            if ((Castle != null) && Castle.IsMasterGuild(this.m_MyGuild))
                            {
                                BaseObjectMove(Castle.m_sHomeMap, Castle.GetHomeX().ToString(), Castle.GetHomeY().ToString());
                            }
                            else
                            {
                                this.SysMsg("无效", TMsgColor.c_Red, TMsgType.t_Hint);
                            }
                            result = true;
                        }
                        else
                        {
                            this.SysMsg("此处无法使用", TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                    }
                    break;
                case 9://修复神水
                    if (RepairWeapon())
                    {
                        result = true;
                    }
                    break;
                case 10://超级祝福油
                    if (SuperRepairWeapon())
                    {
                        result = true;
                    }
                    break;
                case 11://彩票
                    if (WinLottery())
                    {
                        result = true;
                    }
                    break;
            }
            return result;
        }

        /// <summary>
        /// 移动到回城点
        /// </summary>
        public void MoveToHome()
        {
            this.SendRefMsg(Grobal2.RM_SPACEMOVE_FIRE, 0, 0, 0, 0, "");
            BaseObjectMove(this.m_sHomeMap, this.m_nHomeX.ToString(), this.m_nHomeY.ToString());
        }

        private void BaseObjectMove(string sMAP, string sX, string sY)
        {
            int nX;
            int nY;
            TEnvirnoment Envir = this.m_PEnvir;
            if (sMAP == "")
            {
                sMAP = this.m_sMapName;
            }
            if ((sX != "") && (sY != ""))
            {
                nX = HUtil32.Str_ToInt(sX, 0);
                nY = HUtil32.Str_ToInt(sY, 0);
                this.SpaceMove(sMAP, nX, nY, 0);
            }
            else
            {
                this.MapRandomMove(sMAP, 0);
            }
            if ((Envir != this.m_PEnvir) && (this.m_btRaceServer == Grobal2.RC_PLAYOBJECT))
            {
                m_boTimeRecall = false;
            }
        }

        /// <summary>
        /// 使用祝福油,武器加幸运
        /// </summary>
        /// <returns></returns>
        private unsafe bool WeaptonMakeLuck()
        {
            bool result = false;
            TStdItem* StdItem;
            int nRand;
            bool boMakeLuck;
            byte nCode = 0;
            try
            {
                if (this.m_UseItems[TPosition.U_WEAPON]->wIndex <= 0)
                {
                    return result;
                }
                nCode = 1;
                nRand = 0;
                StdItem = UserEngine.GetStdItem(this.m_UseItems[TPosition.U_WEAPON]->wIndex);
                nCode = 2;
                if (StdItem != null)
                {
                    nRand = Math.Abs((HUtil32.HiWord(StdItem->DC) - HUtil32.LoWord(StdItem->DC))) / 5;
                }
                nCode = 3;
                if (HUtil32.Random(GameConfig.nWeaponMakeUnLuckRate) == 1)// 20
                {
                    nCode = 4;
                    this.MakeWeaponUnlock();// 武器加诅咒
                }
                else
                {
                    nCode = 5;
                    boMakeLuck = false;
                    if (this.m_UseItems[TPosition.U_WEAPON]->btValue[4] > 0)
                    {
                        nCode = 6;
                        this.m_UseItems[TPosition.U_WEAPON]->btValue[4] -= 1;
                        this.SysMsg(GameMsgDef.g_sWeaptonMakeLuck, TMsgColor.c_Green, TMsgType.t_Hint);// '武器被加幸运了...'
                        boMakeLuck = true;
                    }
                    else if (this.m_UseItems[TPosition.U_WEAPON]->btValue[3] < GameConfig.nWeaponMakeLuckPoint1)
                    {
                        nCode = 7;
                        this.m_UseItems[TPosition.U_WEAPON]->btValue[3]++;
                        this.SysMsg(GameMsgDef.g_sWeaptonMakeLuck, TMsgColor.c_Green, TMsgType.t_Hint);// '武器被加幸运了...'
                        boMakeLuck = true;
                    }
                    else if ((this.m_UseItems[TPosition.U_WEAPON]->btValue[3] < GameConfig.nWeaponMakeLuckPoint2) && (HUtil32.Random(nRand + GameConfig.nWeaponMakeLuckPoint2Rate) == 1))
                    {
                        nCode = 8;
                        this.m_UseItems[TPosition.U_WEAPON]->btValue[3]++;
                        this.SysMsg(GameMsgDef.g_sWeaptonMakeLuck, TMsgColor.c_Green, TMsgType.t_Hint);// '武器被加幸运了...'
                        boMakeLuck = true;
                    }
                    else if ((this.m_UseItems[TPosition.U_WEAPON]->btValue[3] < GameConfig.nWeaponMakeLuckPoint3) && (HUtil32.Random(nRand * GameConfig.nWeaponMakeLuckPoint3Rate) == 1))
                    {
                        nCode = 9;
                        this.m_UseItems[TPosition.U_WEAPON]->btValue[3]++;
                        this.SysMsg(GameMsgDef.g_sWeaptonMakeLuck, TMsgColor.c_Green, TMsgType.t_Hint);// '武器被加幸运了...'
                        boMakeLuck = true;
                    }
                    nCode = 10;
                    if (this.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                    {
                        nCode = 11;
                        RecalcAbilitys();
                        nCode = 12;
                        this.CompareSuitItem(false);// 套装与身上装备对比
                        nCode = 13;
                        this.SendMsg(this, Grobal2.RM_ABILITY, 0, 0, 0, 0, "");
                        this.SendMsg(this, Grobal2.RM_SUBABILITY, 0, 0, 0, 0, "");
                    }
                    nCode = 14;
                    if (!boMakeLuck)
                    {
                        // '无效'
                        this.SysMsg(GameMsgDef.g_sWeaptonNotMakeLuck, TMsgColor.c_Green, TMsgType.t_Hint);
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.WeaptonMakeLuck Code:" + nCode);
            }
            result = true;
            return result;
        }

        /// <summary>
        /// 修复武器
        /// </summary>
        /// <returns></returns>
        private unsafe bool RepairWeapon()
        {
            bool result = false;
            int nDura;
            TUserItem* UserItem;
            UserItem = this.m_UseItems[TPosition.U_WEAPON];
            if ((UserItem->wIndex <= 0) || ((UserItem->DuraMax / 1000) <= (UserItem->Dura / 1000)))
            {
                return result;
            }
            if (this.CheckItemValue(UserItem, 3))// 禁止修
            {
                return result;
            }
            UserItem->DuraMax -= Convert.ToUInt16((UserItem->DuraMax - UserItem->Dura) / GameConfig.nRepairItemDecDura); // 30
            nDura = HUtil32._MIN(5000, UserItem->DuraMax - UserItem->Dura);
            if (nDura > 0)
            {
                UserItem->Dura += (ushort)nDura;
                this.SendMsg(this, Grobal2.RM_DURACHANGE, 1, UserItem->Dura, UserItem->DuraMax, 0, "");// '武器修复成功...'
                this.SysMsg(GameMsgDef.g_sWeaponRepairSuccess, TMsgColor.c_Green, TMsgType.t_Hint);
                result = true;
            }
            return result;
        }

        /// <summary>
        /// 超级修理武器
        /// </summary>
        /// <returns></returns>
        private unsafe bool SuperRepairWeapon()
        {
            bool result = false;
            if (this.m_UseItems[TPosition.U_WEAPON]->wIndex <= 0)
            {
                return result;
            }
            if (this.CheckItemValue(this.m_UseItems[TPosition.U_WEAPON], 3)) //禁止修
            {
                return result;
            }
            this.m_UseItems[TPosition.U_WEAPON]->Dura = this.m_UseItems[TPosition.U_WEAPON]->DuraMax;
            this.SendMsg(this, Grobal2.RM_DURACHANGE, 1, this.m_UseItems[TPosition.U_WEAPON]->Dura, this.m_UseItems[TPosition.U_WEAPON]->DuraMax, 0, "");// '武器修复成功...'
            this.SysMsg(GameMsgDef.g_sWeaponRepairSuccess, TMsgColor.c_Green, TMsgType.t_Hint);
            return true;
        }

        /// <summary>
        /// 赢彩票
        /// </summary>
        /// <returns></returns>
        private bool WinLottery()
        {
            bool result;
            int nGold;
            int nWinLevel;
            int nRate;
            nGold = 0;
            nWinLevel = 0;
            nRate = HUtil32.Random(GameConfig.nWinLotteryRate);
            if ((nRate >= GameConfig.nWinLottery6Min) && (nRate <= GameConfig.nWinLottery6Max))
            {
                if (GameConfig.nWinLotteryCount < GameConfig.nNoWinLotteryCount)
                {
                    nGold = GameConfig.nWinLottery6Gold;
                    nWinLevel = 6;
                    GameConfig.nWinLotteryLevel6++;
                    GameConfig.nWinLotteryCount++;// 中奖人数
                    GameConfig.nNoWinLotteryCount -= 1;// 未中奖人数
                }
            }
            else if ((nRate >= GameConfig.nWinLottery5Min) && (nRate <= GameConfig.nWinLottery5Max))
            {
                if (GameConfig.nWinLotteryCount < GameConfig.nNoWinLotteryCount)
                {
                    nGold = GameConfig.nWinLottery5Gold;
                    nWinLevel = 5;
                    GameConfig.nWinLotteryLevel5++;
                    GameConfig.nWinLotteryCount++;// 中奖人数
                    GameConfig.nNoWinLotteryCount -= 1;// 未中奖人数
                }
            }
            else if ((nRate >= GameConfig.nWinLottery4Min) && (nRate <= GameConfig.nWinLottery4Max))
            {
                if (GameConfig.nWinLotteryCount < GameConfig.nNoWinLotteryCount)
                {
                    nGold = GameConfig.nWinLottery4Gold;
                    nWinLevel = 4;
                    GameConfig.nWinLotteryLevel4++;
                    GameConfig.nWinLotteryCount++;// 中奖人数
                    GameConfig.nNoWinLotteryCount -= 1;// 未中奖人数
                }
            }
            else if ((nRate >= GameConfig.nWinLottery3Min) && (nRate <= GameConfig.nWinLottery3Max))
            {
                if (GameConfig.nWinLotteryCount < GameConfig.nNoWinLotteryCount)
                {
                    nGold = GameConfig.nWinLottery3Gold;
                    nWinLevel = 3;
                    GameConfig.nWinLotteryLevel3++;
                    GameConfig.nWinLotteryCount++;// 中奖人数
                    GameConfig.nNoWinLotteryCount -= 1;// 未中奖人数
                }
            }
            else if ((nRate >= GameConfig.nWinLottery2Min) && (nRate <= GameConfig.nWinLottery2Max))
            {
                if (GameConfig.nWinLotteryCount < GameConfig.nNoWinLotteryCount)
                {
                    nGold = GameConfig.nWinLottery2Gold;
                    nWinLevel = 2;
                    GameConfig.nWinLotteryLevel2++;
                    GameConfig.nWinLotteryCount++;// 中奖人数
                    GameConfig.nNoWinLotteryCount -= 1;// 未中奖人数
                }
            }
            else if ((nRate >= GameConfig.nWinLottery1Min) && (nRate <= GameConfig.nWinLottery1Max))
            {
                if (GameConfig.nWinLotteryCount < GameConfig.nNoWinLotteryCount)
                {
                    nGold = GameConfig.nWinLottery1Gold;
                    nWinLevel = 1;
                    GameConfig.nWinLotteryLevel1++;
                    GameConfig.nWinLotteryCount++;// 中奖人数
                    GameConfig.nNoWinLotteryCount -= 1;// 未中奖人数
                }
            }
            if (nGold > 0)
            {
                switch (nWinLevel)
                {
                    case 1:// '祝贺您，中了一等奖。'
                        this.SysMsg(GameMsgDef.g_sWinLottery1Msg, TMsgColor.c_Green, TMsgType.t_Hint);
                        break;
                    case 2:// '祝贺您，中了二等奖。'
                        this.SysMsg(GameMsgDef.g_sWinLottery2Msg, TMsgColor.c_Green, TMsgType.t_Hint);
                        break;
                    case 3:// '祝贺您，中了三等奖。'
                        this.SysMsg(GameMsgDef.g_sWinLottery3Msg, TMsgColor.c_Green, TMsgType.t_Hint);
                        break;
                    case 4:// '祝贺您，中了四等奖。'
                        this.SysMsg(GameMsgDef.g_sWinLottery4Msg, TMsgColor.c_Green, TMsgType.t_Hint);
                        break;
                    case 5:// '祝贺您，中了五等奖。'
                        this.SysMsg(GameMsgDef.g_sWinLottery5Msg, TMsgColor.c_Green, TMsgType.t_Hint);
                        break;
                    case 6:// '祝贺您，中了六等奖。'
                        this.SysMsg(GameMsgDef.g_sWinLottery6Msg, TMsgColor.c_Green, TMsgType.t_Hint);
                        break;
                }
                if (IncGold(nGold))
                {
                    this.GoldChanged();
                }
                else
                {
                    this.DropGoldDown(nGold, true, null, null);
                }
            }
            else
            {
                GameConfig.nNoWinLotteryCount += 500;// '等下次机会吧！！！'
                this.SysMsg(GameMsgDef.g_sNotWinLotteryMsg, TMsgColor.c_Red, TMsgType.t_Hint);
            }
            result = true;
            return result;
        }

        private void ChangeServerMakeSlave(TSlaveInfo SalveInfo)
        {
            int nSlavecount;
            TBaseObject BaseObject;
            if (this.m_btJob == 2)
            {
                nSlavecount = 1;
            }
            else
            {
                nSlavecount = 5;
            }
            BaseObject = this.MakeSlave(SalveInfo.sSalveName, 3, SalveInfo.btSalveLevel, nSlavecount, SalveInfo.dwRoyaltySec);
            if (BaseObject != null)
            {
                BaseObject.n294 = SalveInfo.nKillCount;
                BaseObject.m_btSlaveExpLevel = SalveInfo.btSlaveExpLevel;
                BaseObject.m_WAbil.HP = SalveInfo.nHP;
                BaseObject.m_WAbil.MP = SalveInfo.nMP;
                if ((1500 - SalveInfo.btSalveLevel * 200) < BaseObject.m_nWalkSpeed)
                {
                    BaseObject.m_nWalkSpeed = 1500 - SalveInfo.btSalveLevel * 200;
                }
                if (((int)2000 - SalveInfo.btSalveLevel * 200) < BaseObject.m_nNextHitTime)
                {
                    BaseObject.m_nWalkSpeed = 2000 - SalveInfo.btSalveLevel * 200;
                }
                RecalcAbilitys();
                this.CompareSuitItem(false);// 套装与身上装备对比
            }
        }

        /// <summary>
        /// 发送删除交易物品栏的物品
        /// </summary>
        /// <param name="UserItem"></param>
        private unsafe void SendDelDealItem(TUserItem* UserItem)
        {
            SendDefMessage(Grobal2.SM_DEALDELITEM_OK, 0, 0, 0, 0, "");
            if (m_DealCreat != null)
            {
                this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_DEALREMOTEDELITEM, this.ToInt(), 0, 0, 1, 0);
                m_DealCreat.SendSocket(this.m_DefMsg, MakeClientItem(UserItem));
                m_DealCreat.m_DealLastTick = HUtil32.GetTickCount();
                m_DealLastTick = HUtil32.GetTickCount();
            }
        }

        internal unsafe string MakeClientItemEx(TUserItem* UserItem)
        {
            string result = string.Empty;
            TStdItem* StdItem;
            if ((m_nSoftVersionDateEx == 0) || (m_nSoftVersionDateEx == 0))
            {
                StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                if (StdItem != null)
                {
                    return string.Empty;
                }
            }
            else
            {
                return MakeClientItem(UserItem);
            }
            return result;
        }

        internal unsafe string MakeClientItem(TUserItem* UserItem, bool boCarp = false)
        {
            string result = string.Empty;
            TClientItem* ClientItem = null;
            TOClientItem* OClientItem = null;
            string sUserItemName;//自定义物品名称
            TStdItem* StdItem = UserEngine.GetStdItem(UserItem->wIndex);
            if (StdItem != null)
            {
                if (m_DealCreat.m_nSoftVersionDateEx == 0)
                {
                    M2Share.CopyStdItemToOStdItem(StdItem, &OClientItem->s);// 取自定义物品名称
                    sUserItemName = "";
                    if (UserItem->btValue[13] == 1)
                    {
                        sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                    }
                    if (sUserItemName != "")
                    {
                        HUtil32.StrToSByteArry(sUserItemName, OClientItem->s.Name, 14, ref OClientItem->s.NameLen);
                        //OClientItem.s.Name=sUserItemName;
                    }
                    OClientItem->MakeIndex = UserItem->MakeIndex;
                    OClientItem->Dura = UserItem->Dura;
                    OClientItem->DuraMax = UserItem->DuraMax;
                    //byte[] data = new byte[sizeof(TOClientItem)];
                    //fixed (byte* pb = data)
                    //{
                    //    *(TOClientItem*)pb = *OClientItem;
                    //}
                    result = EncryptUnit.EncodeBuffer(OClientItem, sizeof(TOClientItem));
                }
                else
                {
                    ClientItem->s = *StdItem;// 取自定义物品名称
                    sUserItemName = "";
                    if (UserItem->btValue[13] == 1)
                    {
                        sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                    }
                    if (sUserItemName != "")
                    {
                        HUtil32.StrToSByteArry(sUserItemName, ClientItem->s.Name, 14, ref ClientItem->s.NameLen);
                    }
                    if (UserItem->btValue[12] == 1)// 物品发光
                    {
                        ClientItem->s.Reserved1 = 1;
                    }
                    else
                    {
                        ClientItem->s.Reserved1 = 0;
                    }
                    if ((StdItem->StdMode == 60) && (StdItem->Shape != 0))  // 酒类,除烧酒外
                    {
                        if (UserItem->btValue[0] != 0)
                        {
                            ClientItem->s.AC = UserItem->btValue[0];// 酒的品质
                        }
                        if (UserItem->btValue[1] != 0)
                        {
                            ClientItem->s.MAC = UserItem->btValue[1];// 酒的酒精度
                        }
                    }
                    ClientItem->MakeIndex = UserItem->MakeIndex;
                    ClientItem->Dura = UserItem->Dura;
                    ClientItem->DuraMax = UserItem->DuraMax;
                    result = EncryptUnit.EncodeBuffer(ClientItem, sizeof(TClientItem));
                }
            }
            return result;
        }

        /// <summary>
        /// 发送交易物品
        /// </summary>
        /// <param name="UserItem"></param>
        private unsafe void SendAddDealItem(TUserItem* UserItem)
        {
            TStdItem* StdItem;
            TStdItem* StdItem80;
            TClientItem* ClientItem = null;
            TOClientItem* OClientItem = null;
            string sUserItemName;
            SendDefMessage(Grobal2.SM_DEALADDITEM_OK, 0, 0, 0, 0, "");
            if (m_DealCreat != null)
            {
                if (m_DealCreat.m_nSoftVersionDateEx == 0)
                {
                    StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                    if (StdItem != null)
                    {
                        StdItem80 = StdItem;// 取自定义物品名称
                        sUserItemName = "";
                        if (UserItem->btValue[13] == 1)
                        {
                            sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                        }
                        if (sUserItemName != "")
                        {
                            HUtil32.StrToSByteArry(sUserItemName, StdItem80->Name, 14, ref StdItem80->NameLen);
                        }
                        ItemUnit.GetItemAddValue(UserItem, StdItem80);
                        M2Share.CopyStdItemToOStdItem(StdItem80, &OClientItem->s);
                        OClientItem->MakeIndex = UserItem->MakeIndex;
                        OClientItem->Dura = UserItem->Dura;
                        OClientItem->DuraMax = UserItem->DuraMax;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_DEALREMOTEADDITEM, HUtil32.ObjectToInt(this), 0, 0, 1, 0);
                        byte[] data = new byte[sizeof(TOClientItem)];
                        fixed (byte* pb = data)
                        {
                            *(TOClientItem*)pb = *OClientItem;
                        }
                        m_DealCreat.SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TOClientItem)));
                        m_DealCreat.m_DealLastTick = HUtil32.GetTickCount();
                        m_DealLastTick = HUtil32.GetTickCount();
                    }
                }
                else
                {
                    StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                    if (StdItem != null)
                    {
                        StdItem80 = StdItem;
                        ItemUnit.GetItemAddValue(UserItem, StdItem80);// 取自定义物品名称
                        sUserItemName = "";
                        if (UserItem->btValue[13] == 1)
                        {
                            sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                        }
                        if (sUserItemName != "")
                        {
                            HUtil32.StrToSByteArry(sUserItemName, StdItem80->Name, 14, ref StdItem80->NameLen);
                        }
                        if (UserItem->btValue[12] == 1) // 物品发光
                        {
                            StdItem80->Reserved1 = 1;
                        }
                        else
                        {
                            StdItem80->Reserved1 = 0;
                        }
                        if ((StdItem->StdMode == 60) && (StdItem->Shape != 0))// 酒类,除烧酒外 
                        {
                            if (UserItem->btValue[0] != 0)
                            {
                                ClientItem->s.AC = UserItem->btValue[0];// 酒的品质
                            }
                            if (UserItem->btValue[1] != 0)
                            {
                                ClientItem->s.MAC = UserItem->btValue[1];// 酒的酒精度
                            }
                        }
                        ClientItem->s = *StdItem80;
                        ClientItem->MakeIndex = UserItem->MakeIndex;
                        ClientItem->Dura = UserItem->Dura;
                        ClientItem->DuraMax = UserItem->DuraMax;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_DEALREMOTEADDITEM, HUtil32.ObjectToInt(this), 0, 0, 1, 0);
                        byte[] data = new byte[sizeof(TClientItem)];
                        fixed (byte* pb = data)
                        {
                            *(TClientItem*)pb = *ClientItem;
                        }
                        m_DealCreat.SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TClientItem)));
                        m_DealCreat.m_DealLastTick = HUtil32.GetTickCount();
                        m_DealLastTick = HUtil32.GetTickCount();
                    }
                }
            }
        }

        /// <summary>
        /// 客户端打开交易界面
        /// </summary>
        /// <param name="PlayObject"></param>
        private void OpenDealDlg(TPlayObject PlayObject)
        {
            m_boDealing = true;
            m_DealCreat = PlayObject;
            GetBackDealItems();
            SendDefMessage(Grobal2.SM_DEALMENU, 0, 0, 0, 0, m_DealCreat.m_sCharName);
            m_DealLastTick = HUtil32.GetTickCount();
        }

        /// <summary>
        /// 加入小组
        /// </summary>
        /// <param name="PlayObject"></param>
        public void JoinGroup(TPlayObject PlayObject)
        {
            m_GroupOwner = PlayObject;
            SendGroupText(string.Format(GameMsgDef.g_sJoinGroup, this.m_sCharName));
        }

        /// <summary>
        /// 人物的无极真气  每次使用间隔28秒
        /// 0级提升道术40%(2秒)   1级提升60%(4秒)   2级提升80%(6秒)  3级提升100%(8秒)
        /// </summary>
        /// <param name="UserMagic"></param>
        /// <returns></returns>
        public unsafe bool AbilityUp(TUserMagic* UserMagic)
        {
            bool result = false;
            int n14;
            int nSpellPoint = GetSpellPoint(UserMagic);
            if (nSpellPoint > 0)
            {
                if ((HUtil32.GetTickCount() - this.m_dwStatusArrTimeOutTick[2] > GameConfig.nAbilityUpTick * 1000) && (this.m_wStatusArrValue[2] == 0))// 时间间隔
                {
                    if (this.m_WAbil.MP < nSpellPoint)
                    {
                        return result;
                    }
                    this.DamageSpell(nSpellPoint);
                    this.HealthSpellChanged();
                    if (GameConfig.boAbilityUpFixMode)  // 无极真气使用固定时长模式
                    {
                        n14 = GameConfig.nAbilityUpFixUseTime;// 无极真气使用固定时长
                    }
                    else
                    {
                        n14 = (UserMagic->btLevel * 2) + 2 + GameConfig.nAbilityUpUseTime;
                    }
                    this.m_dwStatusArrTimeOutTick[2] = Convert.ToUInt32(HUtil32.GetTickCount() + n14 * 1000);// 使用时间
                    this.m_wStatusArrValue[2] = (ushort)HUtil32.Round((double)HUtil32.HiWord(this.m_WAbil.SC) * (UserMagic->btLevel * 0.2 + 0.4));// 提升值
                    this.SysMsg("道术瞬时提升" + this.m_wStatusArrValue[2] + "，持续 " + n14 + " 秒", TMsgColor.c_Green, TMsgType.t_Hint);
                    RecalcAbilitys();
                    this.CompareSuitItem(false);// 套装与身上装备对比
                    this.SendMsg(this, Grobal2.RM_ABILITY, 0, 0, 0, 0, "");
                    result = true;
                }
                else
                {
                    this.SysMsg("精神力凝聚失败", TMsgColor.c_Red, TMsgType.t_Hint);
                }
            }
            return result;
        }

        /// <summary>
        /// 随机矿石持久力
        /// </summary>
        /// <returns></returns>
        public ushort RandomDrua()
        {
            ushort result = Convert.ToUInt16(HUtil32.Random(GameConfig.nStoneGeneralDuraRate) + GameConfig.nStoneMinDura);
            if (HUtil32.Random(GameConfig.nStoneAddDuraRate) == 0)
            {
                result =  Convert.ToUInt16(result + HUtil32.Random(GameConfig.nStoneAddDuraMax));
            }
            return result;
        }

        /// <summary>
        /// 挖矿,给玩家矿石
        /// </summary>
        private unsafe void MakeMine()
        {
            TUserItem* UserItem = null;
            int nRANDOM;
            if (this.m_ItemList.Count >= Grobal2.MAXBAGITEM)
            {
                return;
            }
            nRANDOM = HUtil32.Random(GameConfig.nStoneTypeRate);
            if (nRANDOM >= GameConfig.nGoldStoneMin && nRANDOM <= GameConfig.nGoldStoneMax)
            {
                UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                if (UserEngine.CopyToUserItemFromName(GameConfig.sGoldStone, UserItem))
                {
                    UserItem->Dura = RandomDrua();
                    this.m_ItemList.Add((IntPtr)UserItem);
                    this.WeightChanged();
                    SendAddItem(UserItem);
                }
                else
                {
                    Marshal.FreeHGlobal((IntPtr)UserItem);
                }
                return;
            }
            if (nRANDOM >= GameConfig.nSilverStoneMin && nRANDOM <= GameConfig.nSilverStoneMax)
            {
                UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                if (UserEngine.CopyToUserItemFromName(GameConfig.sSilverStone, UserItem))
                {
                    UserItem->Dura = RandomDrua();
                    this.m_ItemList.Add((IntPtr)UserItem);
                    this.WeightChanged();
                    SendAddItem(UserItem);
                }
                else
                {
                    Marshal.FreeHGlobal((IntPtr)UserItem);
                }
                return;
            }
            if (nRANDOM >= GameConfig.nSteelStoneMin && nRANDOM <= GameConfig.nSteelStoneMax)
            {
                UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                if (UserEngine.CopyToUserItemFromName(GameConfig.sSteelStone, UserItem))
                {
                    UserItem->Dura = RandomDrua();
                    this.m_ItemList.Add((IntPtr)UserItem);
                    this.WeightChanged();
                    SendAddItem(UserItem);
                }
                else
                {
                    Marshal.FreeHGlobal((IntPtr)UserItem);
                }
                return;
            }
            if (nRANDOM >= GameConfig.nBlackStoneMin && nRANDOM <= GameConfig.nBlackStoneMax)
            {
                UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                if (UserEngine.CopyToUserItemFromName(GameConfig.sBlackStone, UserItem))
                {
                    UserItem->Dura = RandomDrua();
                    this.m_ItemList.Add((IntPtr)UserItem);
                    this.WeightChanged();
                    SendAddItem(UserItem);
                }
                else
                {
                    Marshal.FreeHGlobal((IntPtr)UserItem);
                }
                return;
            }
            UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
            if (UserEngine.CopyToUserItemFromName(GameConfig.sCopperStone, UserItem))
            {
                UserItem->Dura = RandomDrua();
                this.m_ItemList.Add((IntPtr)UserItem);
                this.WeightChanged();
                SendAddItem(UserItem);
            }
            else
            {
                Marshal.FreeHGlobal((IntPtr)UserItem);
            }
        }

        public unsafe TUserItem* QuestCheckItem(string sItemName, ref int nCount, ref int nParam, ref int nDura)
        {
            TUserItem* result;
            TUserItem* UserItem;
            string s1C;
            result = null;
            nParam = 0;
            nDura = 0;
            nCount = 0;
            if (this.m_ItemList.Count > 0)
            {
                for (int I = 0; I < this.m_ItemList.Count; I++)
                {
                    UserItem = (TUserItem*)this.m_ItemList[I];
                    s1C = UserEngine.GetStdItemName(UserItem->wIndex);
                    if ((s1C).ToLower().CompareTo((sItemName).ToLower()) == 0)
                    {
                        if (UserItem->Dura > nDura)
                        {
                            nDura = UserItem->Dura;
                            result = UserItem;
                        }
                        nParam += UserItem->Dura;
                        if (result == null)
                        {
                            result = UserItem;
                        }
                        nCount++;
                    }
                }
            }
            return result;
        }

        public unsafe bool QuestTakeCheckItem(TUserItem* CheckItem)
        {
            bool result = false;
            TUserItem* UserItem;
            for (int I = this.m_ItemList.Count - 1; I >= 0; I--)
            {
                if (this.m_ItemList.Count <= 0)
                {
                    break;
                }
                UserItem = (TUserItem*)this.m_ItemList[I];
                if (UserItem == CheckItem)
                {
                    SendDelItems(UserItem);
                    this.m_ItemList.RemoveAt(I);
                    Marshal.FreeHGlobal((IntPtr)UserItem);
                    UserItem = null;
                    result = true;
                    break;
                }
            }
            for (int I = this.m_UseItems.GetLowerBound(0); I <= this.m_UseItems.GetUpperBound(0); I++)
            {
                if (this.m_UseItems[I] == CheckItem)
                {
                    SendDelItems(this.m_UseItems[I]);
                    this.m_UseItems[I]->wIndex = 0;
                    result = true;
                    break;
                }
            }
            return result;
        }

        private unsafe void ClientQueryRepairCost(int nParam1, int nInt, string sMsg)
        {
            TUserItem* UserItem;
            TUserItem* UserItemA;
            TMerchant Merchant;
            string sUserItemName;
            UserItemA = null;
            if (this.m_ItemList.Count > 0)
            {
                for (int I = 0; I < this.m_ItemList.Count; I++)
                {
                    UserItem = (TUserItem*)this.m_ItemList[I];
                    if (UserItem == null)
                    {
                        continue;
                    }
                    if ((UserItem->MakeIndex == nInt))
                    {
                        // 取自定义物品名称
                        sUserItemName = "";
                        if (UserItem->btValue[13] == 1)
                        {
                            sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                        }
                        if (sUserItemName == "")
                        {
                            sUserItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                        }
                        if (string.Compare(sUserItemName, sMsg, true) == 0)
                        {
                            UserItemA = UserItem;
                            break;
                        }
                    }
                }
            }
            if (UserItemA == null)
            {
                return;
            }
            Merchant = UserEngine.FindMerchant(nParam1);
            if ((Merchant != null) && ((Merchant.m_PEnvir == this.m_PEnvir) && (Math.Abs(Merchant.m_nCurrX - this.m_nCurrX) < 15) && (Math.Abs(Merchant.m_nCurrY - this.m_nCurrY) < 15)))
            {
                Merchant.ClientQueryRepairCost(this, UserItemA);
            }
        }

        /// <summary>
        /// 客户端修复物品
        /// </summary>
        /// <param name="nParam1"></param>
        /// <param name="nInt"></param>
        /// <param name="sMsg"></param>
        private unsafe void ClientRepairItem(int nParam1, int nInt, string sMsg)
        {
            TUserItem* UserItem = null;
            TMerchant Merchant;
            string sUserItemName;
            string sCheckItemName;
            bool bo19 = false;
            if (this.m_ItemList.Count > 0)
            {
                for (int I = 0; I < this.m_ItemList.Count; I++)
                {
                    UserItem = (TUserItem*)this.m_ItemList[I];
                    if (UserItem->MakeIndex == nInt)
                    {
                        if (this.CheckItemValue(UserItem, 3))
                        {
                            this.SendMsg(this, Grobal2.RM_USERREPAIRITEM_FAIL, 0, 0, 0, 0, "");// 禁止修
                            break;
                        }
                        else
                        {
                            sCheckItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                            if (this.PlugOfCheckCanItem(3, sCheckItemName, false, 0, 0))// 禁止物品规则(管理插件功能)
                            {
                                this.SendMsg(this, Grobal2.RM_USERREPAIRITEM_FAIL, 0, 0, 0, 0, "");
                                break;
                            }
                        }
                    }
                    // 取自定义物品名称
                    sUserItemName = "";
                    if (UserItem->btValue[13] == 1)
                    {
                        sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                    }
                    if (sUserItemName == "")
                    {
                        sUserItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                    }
                    if ((UserItem->MakeIndex == nInt) && ((sUserItemName).ToLower().CompareTo((sMsg).ToLower()) == 0))
                    {
                        bo19 = true;
                        break;
                    }
                }
            }
            if ((UserItem == null) || !bo19)
            {
                return;
            }
            Merchant = UserEngine.FindMerchant(nParam1);
            if ((Merchant != null) && ((Merchant.m_PEnvir == this.m_PEnvir) && (Math.Abs(Merchant.m_nCurrX - this.m_nCurrX) < 15) && (Math.Abs(Merchant.m_nCurrY - this.m_nCurrY) < 15)))
            {
                Merchant.ClientRepairItem(this, UserItem);
            }
        }

        /// <summary>
        /// 客户端存物品至仓库
        /// </summary>
        /// <param name="NPC"></param>
        /// <param name="nItemIdx"></param>
        /// <param name="sMsg"></param>
        private unsafe void ClientStorageItem(int NPC, int nItemIdx, string sMsg)
        {
            TMerchant Merchant;
            TUserItem* UserItem;
            bool bo19;
            TStdItem* StdItem;
            string sUserItemName;
            string sCheckItemName;
            byte nCode;
            nCode = 0;
            m_boCanQueryBag = true;// 出售物品时,不能刷新包裹
            try
            {
                try
                {
                    Merchant = UserEngine.FindMerchant(NPC);
                    nCode = 1;
                    if ((Merchant != null) && (Merchant.m_boBigStorage))
                    {
                        // 无限仓库
                        nCode = 2;
                        bo19 = false;
                        if (sMsg.IndexOf(" ") >= 0)
                        {
                            // 折分物品名称(信件物品的名称后面加了使用次数)
                            HUtil32.GetValidStr3(sMsg, ref sMsg, new string[] { " " });
                        }
                        if ((m_nPayMent == 1) && !GameConfig.boTryModeUseStorage)
                        {
                            // '试玩模式不可以使用仓库功能！！！'
                            this.SysMsg(GameMsgDef.g_sTryModeCanotUseStorage, TMsgColor.c_Red, TMsgType.t_Hint);
                            SendDefMessage(Grobal2.SM_STORAGE_FAIL, 0, 0, 0, 0, "");
                            return;
                        }
                        nCode = 3;
                        if ((m_BigStorageItemList != null) && (m_BigStorageItemList.Count > GameConfig.nBigStorageLimitCount))
                        {
                            this.SysMsg(string.Format(GameMsgDef.g_sBigStorageCountIsNul, GameConfig.nBigStorageLimitCount), TMsgColor.c_Red, TMsgType.t_Hint);
                            SendDefMessage(Grobal2.SM_STORAGE_FAIL, 0, 0, 0, 0, "");
                            return;
                        }
                        nCode = 4;
                        for (int I = this.m_ItemList.Count - 1; I >= 0; I--)
                        {
                            if (this.m_ItemList.Count <= 0)
                            {
                                break;
                            }
                            UserItem = (TUserItem*)(TUserItem*)this.m_ItemList[I];
                            if (UserItem->MakeIndex == nItemIdx)
                            {
                                nCode = 5;
                                if (this.CheckItemValue(UserItem, 2))// 禁止存
                                {
                                    break;
                                }
                                else
                                {
                                    nCode = 6;
                                    sCheckItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                                    if (this.PlugOfCheckCanItem(2, sCheckItemName, false, 0, 0)) // 禁止物品规则(禁止存)
                                    {
                                        break;
                                    }
                                }
                            }
                            nCode = 7;
                            sUserItemName = "";// 取自定义物品名称
                            if (UserItem->btValue[13] == 1)
                            {
                                sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                            }
                            if (sUserItemName == "")
                            {
                                sUserItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                            }
                            nCode = 8;
                            if (UserItem->MakeIndex == nItemIdx && string.Compare(sUserItemName, sMsg, true) == 0)
                            {
                                nCode = 9;
                                // 检查NPC是否允许存物品
                                if ((Merchant.m_boBigStorage) && (((Merchant.m_PEnvir == this.m_PEnvir) && (Math.Abs(Merchant.m_nCurrX - this.m_nCurrX) < 15) && (Math.Abs(Merchant.m_nCurrY - this.m_nCurrY) < 15)) || (Merchant == M2Share.g_FunctionNPC)))
                                {
                                    nCode = 10;
                                    //if (GameMsgDef.g_Storage.Add(ref m_BigStorageItemList, this.m_sCharName, UserItem))
                                    //{
                                    //    nCode = 11;
                                    //    this.m_ItemList.RemoveAt(I);
                                    //    ClearCopyItem(0, UserItem->wIndex, UserItem->MakeIndex); // 清理包裹和仓库复制物品
                                    //    Dispose(UserItem);
                                    //    this.WeightChanged();
                                    //    SendDefMessage(Grobal2.SM_STORAGE_OK, 0, 0, 0, 0, "");
                                    //    StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                                    //    nCode = 12;
                                    //    if (StdItem != null)
                                    //    {
                                    //        nCode = 23;
                                    //        if (StdItem->NeedIdentify == 1)
                                    //        {
                                    //            M2Share.AddGameDataLog("1" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString() + "\09" + (this.m_nCurrY).ToString() + "\09" + this.m_sCharName + "\09" + HUtil32.SBytePtrToString(StdItem->Name,0,StdItem->NameLen) + "\09" + (UserItem->MakeIndex).ToString() + "\09" + "(" + (HUtil32.LoWord(StdItem->DC)).ToString() + "/" + (HUtil32.HiWord(StdItem->DC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MC)).ToString() + "/" + (HUtil32.HiWord(StdItem->MC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->SC)).ToString() + "/" + (HUtil32.HiWord(StdItem->SC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->AC)).ToString() + "/" + (HUtil32.HiWord(StdItem->AC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MAC)).ToString() + "/" + (HUtil32.HiWord(StdItem->MAC)).ToString() + ")" + (UserItem->btValue[0]).ToString() + "/" + (UserItem->btValue[1]).ToString() + "/" + (UserItem->btValue[2]).ToString() + "/" + (UserItem->btValue[3]).ToString() + "/" + (UserItem->btValue[4]).ToString() + "/" + (UserItem->btValue[5]).ToString() + "/" + (UserItem->btValue[6]).ToString() + "/" + (UserItem->btValue[7]).ToString() + "/" + (UserItem->btValue[8]).ToString() + "/" + (UserItem->btValue[14]).ToString() + "\09" + Merchant.m_sCharName);
                                    //        }
                                    //    }
                                    //}
                                    //else
                                    //{
                                    //    SendDefMessage(Grobal2.SM_STORAGE_FULL, 0, 0, 0, 0, "");
                                    //}
                                    bo19 = true;
                                }
                                break;
                            }
                        }
                    }
                    else
                    {
                        bo19 = false;
                        nCode = 13;
                        if (sMsg.IndexOf(" ") >= 0)
                        {
                            // 折分物品名称(信件物品的名称后面加了使用次数)
                            HUtil32.GetValidStr3(sMsg, ref sMsg, new string[] { " " });
                        }
                        if ((m_nPayMent == 1) && !GameConfig.boTryModeUseStorage)
                        {
                            // '试玩模式不可以使用仓库功能！！！'
                            this.SysMsg(GameMsgDef.g_sTryModeCanotUseStorage, TMsgColor.c_Red, TMsgType.t_Hint);
                            return;
                        }
                        nCode = 14;
                        for (int I = this.m_ItemList.Count - 1; I >= 0; I--)
                        {
                            if (this.m_ItemList.Count <= 0)
                            {
                                break;
                            }
                            UserItem = (TUserItem*)(TUserItem*)this.m_ItemList[I];
                            nCode = 15;
                            if (UserItem->MakeIndex == nItemIdx)
                            {
                                if (this.CheckItemValue(UserItem, 2)) // 禁止存
                                {
                                    break;
                                }
                                else
                                {
                                    nCode = 16;
                                    sCheckItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                                    if (this.PlugOfCheckCanItem(2, sCheckItemName, false, 0, 0)) // 禁止物品规则(禁止存)
                                    {
                                        break;
                                    }
                                }
                            }
                            sUserItemName = "";// 取自定义物品名称
                            if (UserItem->btValue[13] == 1)
                            {
                                sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                            }
                            if (sUserItemName == "")
                            {
                                sUserItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                            }
                            nCode = 17;
                            if ((UserItem->MakeIndex == nItemIdx) && ((sUserItemName).ToLower().CompareTo((sMsg).ToLower()) == 0))
                            {
                                nCode = 18;
                                Merchant = UserEngine.FindMerchant(NPC);// 检查NPC是否允许存物品
                                if ((Merchant != null) && (Merchant.m_boStorage) && (((Merchant.m_PEnvir == this.m_PEnvir) && (Math.Abs(Merchant.m_nCurrX - this.m_nCurrX) < 15)
                                    && (Math.Abs(Merchant.m_nCurrY - this.m_nCurrY) < 15)) || (Merchant == M2Share.g_FunctionNPC)))
                                {
                                    nCode = 19;
                                    if (m_StorageItemList.Count < Grobal2.MAXBAGITEM)
                                    {
                                        nCode = 20;
                                        m_StorageItemList.Add((IntPtr)UserItem);
                                        this.m_ItemList.RemoveAt(I);
                                        this.WeightChanged();
                                        SendDefMessage(Grobal2.SM_STORAGE_OK, 0, 0, 0, 0, "");
                                        nCode = 21;
                                        StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                                        nCode = 22;
                                        if (StdItem->NeedIdentify == 1)
                                        {
                                            M2Share.AddGameDataLog("1" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString() + "\09" + (this.m_nCurrY).ToString() + "\09"
                                                + this.m_sCharName + "\09" + HUtil32.SBytePtrToString(StdItem->Name, 0, StdItem->NameLen) + "\09" + (UserItem->MakeIndex).ToString()
                                                + "\09" + "(" + (HUtil32.LoWord(StdItem->DC)).ToString() + "/" + (HUtil32.HiWord(StdItem->DC)).ToString() + ")" + "("
                                                + HUtil32.LoWord(StdItem->MC) + "/" + (HUtil32.HiWord(StdItem->MC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->SC)).ToString() + "/"
                                                + HUtil32.HiWord(StdItem->SC) + ")" + "(" + HUtil32.LoWord(StdItem->AC) + "/" + (HUtil32.HiWord(StdItem->AC)).ToString() + ")" + "("
                                                + (HUtil32.LoWord(StdItem->MAC)).ToString() + "/" + (HUtil32.HiWord(StdItem->MAC)).ToString() + ")" + (UserItem->btValue[0]).ToString()
                                                + "/" + (UserItem->btValue[1]).ToString() + "/" + (UserItem->btValue[2]).ToString() + "/" + (UserItem->btValue[3]).ToString() + "/"
                                                + (UserItem->btValue[4]).ToString() + "/" + (UserItem->btValue[5]).ToString() + "/" + (UserItem->btValue[6]).ToString() + "/"
                                                + (UserItem->btValue[7]).ToString() + "/" + (UserItem->btValue[8]).ToString() + "/" + (UserItem->btValue[14]).ToString() + "\09"
                                                + Merchant.m_sCharName);
                                        }
                                    }
                                    else
                                    {
                                        SendDefMessage(Grobal2.SM_STORAGE_FULL, 0, 0, 0, 0, "");
                                    }
                                    bo19 = true;
                                }
                                break;
                            }
                        }
                    }
                    if (!bo19)
                    {
                        SendDefMessage(Grobal2.SM_STORAGE_FAIL, 0, 0, 0, 0, "");
                    }
                }
                catch
                {
                    M2Share.MainOutMessage("{异常} TPlayObject.ClientStorageItem  Code:" + nCode);
                }
            }
            finally
            {
                m_boCanQueryBag = false;// 出售物品时,不能刷新包裹
            }
        }

        /// <summary>
        /// 仓库取物品
        /// </summary>
        /// <param name="NPC"></param>
        /// <param name="nItemIdx"></param>
        /// <param name="sMsg"></param>
        private unsafe void ClientTakeBackStorageItem(int NPC, int nItemIdx, string sMsg)
        {
            TMerchant Merchant;
            int I;
            TUserItem* UserItem;
            TUserItem Item;
            bool bo19;
            TStdItem* StdItem;
            string sUserItemName;
            if (m_boCanQueryBag)// 使用物品时,不能取出物品
            {
                return;
            }
            Merchant = UserEngine.FindMerchant(NPC);
            if ((Merchant != null) && (Merchant.m_boBigGetBack)) // 无限仓库
            {
                bo19 = false;
                if ((m_nPayMent == 1) && !GameConfig.boTryModeUseStorage)
                {
                    // '试玩模式不可以使用仓库功能！！！'
                    this.SysMsg(GameMsgDef.g_sTryModeCanotUseStorage, TMsgColor.c_Red, TMsgType.t_Hint);
                    return;
                }
                if (!m_boCanGetBackItem)
                {
                    this.SendMsg(Merchant, Grobal2.RM_MENU_OK, 0, HUtil32.ObjectToInt(this), 0, 0, GameMsgDef.g_sStorageIsLockedMsg + "\\ \\"
                        + "仓库开锁命令: @" + M2Share.g_GameCommand.UNLOCKSTORAGE.sCmd + "\\" + "仓库加锁命令: @" + M2Share.g_GameCommand.__Lock.sCmd + "\\"
                        + "设置密码命令: @" + M2Share.g_GameCommand.SETPASSWORD.sCmd + "\\" + "修改密码命令: @" + M2Share.g_GameCommand.CHGPASSWORD.sCmd);
                    return;
                }
                //if (GameMsgDef.g_Storage.GetItem(m_BigStorageItemList, sMsg, nItemIdx, ref Item))
                //{
                //    UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                //for (int i = 0; i < 22; i++)
                //{
                //    UserItem->btValue[i] = 0;
                //}
                //    UserItem = Item;
                //    if ((this.IsAddWeightAvailable(UserEngine.GetStdItemWeight(UserItem->wIndex))))
                //    {
                //        // 检查NPC是否允许取物品
                //        if ((Merchant != null) && (Merchant.m_boBigGetBack) && (((Merchant.m_PEnvir == this.m_PEnvir) && (Math.Abs(Merchant.m_nCurrX - this.m_nCurrX) < 15) && (Math.Abs(Merchant.m_nCurrY - this.m_nCurrY) < 15)) || (Merchant == M2Share.g_FunctionNPC)))
                //        {
                //            ClearCopyItem(0, UserItem->wIndex, UserItem->MakeIndex);
                //            // 清理包裹和仓库复制物品 20080816
                //            if (this.AddItemToBag(UserItem))
                //            {
                //                SendAddItem(UserItem);
                //                //GameMsgDef.g_Storage.Delete(ref m_BigStorageItemList, sMsg, nItemIdx);
                //                SendDefMessage(Grobal2.SM_TAKEBACKSTORAGEITEM_OK, nItemIdx, 0, 0, 0, "");
                //                StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                //                if (StdItem->NeedIdentify == 1)
                //                {
                //                    M2Share.AddGameDataLog("0" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString() + "\09" + (this.m_nCurrY).ToString() + "\09" + this.m_sCharName + "\09" + HUtil32.SBytePtrToString(StdItem->Name,0,StdItem->NameLen) + "\09" + (UserItem->MakeIndex).ToString() + "\09" + "(" + (HUtil32.LoWord(StdItem->DC)).ToString() + "/" + (HUtil32.HiWord(StdItem->DC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MC)).ToString() + "/" + (HUtil32.HiWord(StdItem->MC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->SC)).ToString() + "/" + (HUtil32.HiWord(StdItem->SC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->AC)).ToString() + "/" + (HUtil32.HiWord(StdItem->AC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MAC)).ToString() + "/" + (HUtil32.HiWord(StdItem->MAC)).ToString() + ")" + (UserItem->btValue[0]).ToString() + "/" + (UserItem->btValue[1]).ToString() + "/" + (UserItem->btValue[2]).ToString() + "/" + (UserItem->btValue[3]).ToString() + "/" + (UserItem->btValue[4]).ToString() + "/" + (UserItem->btValue[5]).ToString() + "/" + (UserItem->btValue[6]).ToString() + "/" + (UserItem->btValue[7]).ToString() + "/" + (UserItem->btValue[8]).ToString() + "/" + (UserItem->btValue[14]).ToString() + "\09" + Merchant.m_sCharName);
                //                }
                //            }
                //            else
                //            {
                //                Dispose(UserItem);
                //                SendDefMessage(Grobal2.SM_TAKEBACKSTORAGEITEM_FULLBAG, 0, 0, 0, 0, "");
                //            }
                //            bo19 = true;
                //        }
                //    }
                //    else
                //    {
                //        Dispose(UserItem);
                //        // '无法携带更多的东西！！！'
                //        this.SysMsg(GameMsgDef.g_sCanotGetItems, TMsgColor.c_Red, TMsgType.t_Hint);
                //    }
                //}
            }
            else
            {
                bo19 = false;
                Merchant = UserEngine.FindMerchant(NPC);
                if (Merchant == null)
                {
                    return;
                }
                if ((m_nPayMent == 1) && !GameConfig.boTryModeUseStorage)
                {
                    // '试玩模式不可以使用仓库功能！！！'
                    this.SysMsg(GameMsgDef.g_sTryModeCanotUseStorage, TMsgColor.c_Red, TMsgType.t_Hint);
                    return;
                }
                if (!m_boCanGetBackItem)
                {
                    this.SendMsg(Merchant, Grobal2.RM_MENU_OK, 0, HUtil32.ObjectToInt(this), 0, 0, GameMsgDef.g_sStorageIsLockedMsg + "\\ \\" + "仓库开锁命令: @"
                        + M2Share.g_GameCommand.UNLOCKSTORAGE.sCmd + "\\" + "仓库加锁命令: @" + M2Share.g_GameCommand.__Lock.sCmd + "\\" + "设置密码命令: @"
                        + M2Share.g_GameCommand.SETPASSWORD.sCmd + "\\" + "修改密码命令: @" + M2Share.g_GameCommand.CHGPASSWORD.sCmd);
                    return;
                }
                if (m_StorageItemList.Count > 0)
                {
                    for (I = m_StorageItemList.Count - 1; I >= 0; I--)
                    {
                        UserItem = (TUserItem*)m_StorageItemList[I];// 取自定义物品名称
                        sUserItemName = "";
                        if (UserItem->btValue[13] == 1)
                        {
                            sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                        }
                        if (sUserItemName == "")
                        {
                            sUserItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                        }
                        if ((UserItem->MakeIndex == nItemIdx) && ((sUserItemName).ToLower().CompareTo((sMsg).ToLower()) == 0))
                        {
                            if ((this.IsAddWeightAvailable(UserEngine.GetStdItemWeight(UserItem->wIndex))))
                            {
                                // 检查NPC是否允许取物品
                                if ((Merchant != null) && (Merchant.m_boGetback) && (((Merchant.m_PEnvir == this.m_PEnvir) && (Math.Abs(Merchant.m_nCurrX - this.m_nCurrX) < 15) &&
                                    (Math.Abs(Merchant.m_nCurrY - this.m_nCurrY) < 15)) || (Merchant == M2Share.g_FunctionNPC)))
                                {
                                    ClearCopyItem(0, UserItem->wIndex, UserItem->MakeIndex);// 清理包裹和仓库复制物品
                                    if (this.AddItemToBag(UserItem))
                                    {
                                        SendAddItem(UserItem);
                                        m_StorageItemList.RemoveAt(I);
                                        SendDefMessage(Grobal2.SM_TAKEBACKSTORAGEITEM_OK, nItemIdx, 0, 0, 0, "");
                                        StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                                        if (StdItem->NeedIdentify == 1)
                                        {
                                            M2Share.AddGameDataLog("0" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString()
                                                + "\09" + (this.m_nCurrY).ToString() + "\09" + this.m_sCharName + "\09" + HUtil32.SBytePtrToString(StdItem->Name, 0, StdItem->NameLen)
                                                + "\09" + (UserItem->MakeIndex).ToString() + "\09" + "(" +
                                                (HUtil32.LoWord(StdItem->DC)).ToString() + "/" + (HUtil32.HiWord(StdItem->DC)).ToString()
                                                + ")" + "(" + (HUtil32.LoWord(StdItem->MC)).ToString() + "/" +
                                                (HUtil32.HiWord(StdItem->MC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->SC)).ToString()
                                                + "/" + (HUtil32.HiWord(StdItem->SC)).ToString() + ")" + "(" +
                                                (HUtil32.LoWord(StdItem->AC)).ToString() + "/" + (HUtil32.HiWord(StdItem->AC)).ToString()
                                                + ")" + "(" + (HUtil32.LoWord(StdItem->MAC)).ToString() + "/" +
                                                (HUtil32.HiWord(StdItem->MAC)).ToString() + ")" + (UserItem->btValue[0]).ToString() + "/"
                                                + (UserItem->btValue[1]).ToString() + "/" + (UserItem->btValue[2]).ToString() + "/" +
                                                (UserItem->btValue[3]).ToString() + "/" + (UserItem->btValue[4]).ToString() + "/" +
                                                (UserItem->btValue[5]).ToString() + "/" + (UserItem->btValue[6]).ToString() + "/" +
                                                (UserItem->btValue[7]).ToString() + "/" + (UserItem->btValue[8]).ToString() + "/" +
                                                (UserItem->btValue[14]).ToString() + "\09" + Merchant.m_sCharName);
                                        }
                                    }
                                    else
                                    {
                                        SendDefMessage(Grobal2.SM_TAKEBACKSTORAGEITEM_FULLBAG, 0, 0, 0, 0, "");
                                    }
                                    bo19 = true;
                                }
                            }
                            else
                            {
                                // '无法携带更多的东西！！！'
                                this.SysMsg(GameMsgDef.g_sCanotGetItems, TMsgColor.c_Red, TMsgType.t_Hint);
                            }
                            break;
                        }
                    }
                }
            }
            if (Merchant == null)
            {
                return;
            }
            if (!bo19)
            {
                SendDefMessage(Grobal2.SM_TAKEBACKSTORAGEITEM_FAIL, 0, 0, 0, 0, "");
            }
        }

        /// <summary>
        /// 创建保存人物数据
        /// </summary>
        /// <param name="HumanRcd"></param>
        public unsafe void MakeSaveRcd(THumDataInfo* HumanRcd)
        {
            THumDataInfo hdi;
            THumData* HumData;
            TUserItem* HumItems = (TUserItem*)(hdi.Data.HumItemsBuff);
            TUserItem* HumAddItems;
            TUserItem* BagItems;
            THumMagic* HumMagics;
            THumMagic* HumNGMagics;
            THumMagic* HumBatterMagics;
            TUserMagic* UserMagic;
            TUserItem* StorageItems;
            HumanRcd->Header.boIsHero = false;
            HumanRcd->Header.btJob = this.m_btJob;
            HumData = &HumanRcd->Data;//Size 4487
            HUtil32.StrToSByteArry(this.m_sCharName, HumData->sChrName, 14, ref HumData->ChrNameLen);
            HUtil32.StrToSByteArry(this.m_sMapName, HumData->sCurMap, 16, ref HumData->CurMapLen);
            HumData->wCurX = (ushort)this.m_nCurrX;
            HumData->wCurY = (ushort)this.m_nCurrY;
            HumData->btDir = this.m_btDirection;
            HumData->btHair = this.m_btHair;
            HumData->btSex = this.m_btGender;
            HumData->btJob = this.m_btJob;
            HumData->nGold = this.m_nGold;
            HumData->Abil.Level = this.m_Abil.Level;
            HumData->Abil.HP = this.m_Abil.HP;
            HumData->Abil.MP = this.m_Abil.MP;
            HumData->Abil.MaxHP = this.m_Abil.MaxHP;
            HumData->Abil.MaxMP = this.m_Abil.MaxMP;
            HumData->Abil.Exp = (int)this.m_Abil.Exp;
            HumData->Abil.MaxExp = (int)this.m_Abil.MaxExp;
            HumData->Abil.Weight = this.m_Abil.Weight;
            HumData->Abil.MaxWeight = this.m_Abil.MaxWeight;
            HumData->Abil.WearWeight = (byte)this.m_Abil.WearWeight;
            HumData->Abil.MaxWearWeight = (byte)this.m_Abil.MaxWearWeight;
            HumData->Abil.HandWeight = (byte)this.m_Abil.HandWeight;
            HumData->Abil.MaxHandWeight = (byte)this.m_Abil.MaxHandWeight;
            HumData->Abil.NG = (ushort)this.m_Skill69NH;// 内功当前内力值
            HumData->Abil.MaxNG = (ushort)this.m_Skill69MaxNH;// 内力值上限
            HumData->n_Reserved = this.m_Abil.Alcohol;// 酒量
            HumData->n_Reserved1 = this.m_Abil.MaxAlcohol;// 酒量上限
            HumData->n_Reserved2 = this.m_Abil.WineDrinkValue;// 醉酒度
            HumData->btUnKnow2[2] = this.n_DrinkWineQuality;// 饮酒时酒的品质
            HumData->UnKnow[4] = (byte)this.n_DrinkWineAlcohol;// 饮酒时酒的度数
            HumData->UnKnow[5] = (byte)this.m_btMagBubbleDefenceLevel;// 魔法盾等级
            HumData->nReserved1 = this.m_Abil.MedicineValue;// 当前药力值
            HumData->nReserved2 = this.m_Abil.MaxMedicineValue;// 药力值上限
            HumData->boReserved3 = this.n_DrinkWineDrunk;// 人是否喝酒醉了
            HumData->nReserved3 = dw_UseMedicineTime;// 使用药酒时间,计算长时间没使用药酒
            HumData->n_Reserved3 = this.n_MedicineLevel; // 药力值等级
            HumData->Exp68 = (int)this.m_Exp68;// 酒气护体当前经验
            HumData->MaxExp68 = (int)this.m_MaxExp68;// 酒气护体升级经验
            HumData->UnKnow[6] = Convert.ToByte(this.m_boTrainingNG);// 是否学习过内功
            if (m_boTrainingNG)// 内功等级
            {
                HumData->UnKnow[7] = this.m_NGLevel;
            }
            else
            {
                HumData->UnKnow[7] = 0;
            }
            HumData->nExpSkill69 = (int)this.m_ExpSkill69;// 内功当前经验
            HumData->Abil.HP = this.m_WAbil.HP;
            HumData->Abil.MP = this.m_WAbil.MP;
            HUtil32.UShortArrayToUShortPtr(HumData->wStatusTimeArr, 12, this.m_wStatusTimeArr);
            HUtil32.StrToSByteArry(this.m_sHomeMap, HumData->sHomeMap, 16, ref HumData->HomeMapLen);
            HumData->wHomeX = (ushort)this.m_nHomeX;
            HumData->wHomeY = (ushort)this.m_nHomeY;
            HumData->nPKPOINT = this.m_nPkPoint;
            HumData->BonusAbil = this.m_BonusAbil;
            HumData->nBonusPoint = this.m_nBonusPoint;
            HUtil32.StrToSByteArry(this.m_sStoragePwd, HumData->sStoragePwd, 7, ref HumData->StoragePwdLen);
            HumData->btCreditPoint = this.m_btCreditPoint;
            HumData->btReLevel = this.m_btReLevel;
            HUtil32.StrToSByteArry(this.m_sMasterName, HumData->sMasterName, 14, ref HumData->MasterNameLen);
            HumData->boMaster = this.m_boMaster;
            HUtil32.StrToSByteArry(this.m_sDearName, HumData->sDearName, 14, ref HumData->DearNameLen);
            HumData->nGameGold = this.m_nGameGold;
            HumData->nGameDiaMond = this.m_nGAMEDIAMOND;//金刚石
            HumData->nGameGird = this.m_nGAMEGIRD;//灵符
            HumData->btGameGlory = this.m_btGameGlory;//荣誉
            HumData->nGamePoint = this.m_nGamePoint;
            if (GameConfig.boSaveExpRate)  // 是否保存双倍经验时间
            {
                HumData->nEXPRATE = m_nKillMonExpRate - m_nItmeIncMonExpRate;//经验倍数
                if (HumData->nEXPRATE <= 0)
                {
                    HumData->nEXPRATE = 100;//临时处理用
                }
                HumData->nExpTime = m_dwKillMonExpRateTime;//双倍经验时间
            }
            else
            {
                HumData->nEXPRATE = 100;
                HumData->nExpTime = 0;
            }
            if (m_boAllowGroup)
            {
                HumData->btAllowGroup = 1;
            }
            else
            {
                HumData->btAllowGroup = 0;
            }
            HumData->btF9 = this.btB2;
            HumData->btAttatckMode = this.m_btAttatckMode;
            HumData->btIncHealth = (byte)this.m_nIncHealth;
            HumData->btIncSpell = (byte)this.m_nIncSpell;
            HumData->btIncHealing = (byte)this.m_nIncHealing;
            HumData->btFightZoneDieCount = (byte)this.m_nFightZoneDieCount;
            HUtil32.StrToSByteArry(this.m_sUserID, HumData->sAccount, 10, ref HumData->AccountLen);
            HumData->boLockLogon = this.m_boLockLogon;
            HumData->wContribution = this.m_wContribution;
            HumData->nHungerStatus = this.m_nHungerStatus;
            HumData->boAllowGuildReCall = this.m_boAllowGuildReCall;
            HumData->wGroupRcallTime = (ushort)this.m_wGroupRcallTime;
            HumData->dBodyLuck = this.m_dBodyLuck;
            HumData->boAllowGroupReCall = this.m_boAllowGroupReCall;
            HumData->btLastOutStatus = this.m_btLastOutStatus;//退出状态 1为死亡退出
            HumData->wMasterCount = this.m_wMasterCount;// 出师徒弟数
            HumData->btUnKnow2[0] = Convert.ToByte(bo_YBDEAL);// 是否开通元宝寄售
            HumData->n_WinExp = (int)this.m_nWinExp;// 聚灵珠  累计经验
            HumData->n_UsesItemTick = this.n_UsesItemTick;// 聚灵珠聚集时间
            HUtil32.ByteArrayToBytePtr(HumData->QuestFlag, 128, this.m_QuestFlag);
            HumData->boHasHero = this.m_boHasHero;
            HumData->boReserved1 = this.m_boHasHeroTwo;
            HumData->boIsHero = false;
            HUtil32.StrToSByteArry(m_sHeroCharName, HumData->sHeroChrName, 14, ref HumData->HeroChrName);
            HUtil32.StrToSByteArry(m_sDeputyHeroCharName, HumData->sMentHeroChrName, 14, ref HumData->MentHeroChrNameLen);// 副将英雄名字
            HumData->btUnKnow2[1] = this.n_HeroSave;// 是否保存英雄
            HumData->btEF = this.n_myHeroTpye;// 角色身上带的英雄所属的类型 
            HumData->boReserved = this.m_boPlayDrink;// 是否请过酒 T-请过酒
            HumData->m_GiveDate = this.m_GiveGuildFountationDate;// 人物领取行会酒泉日期
            HumData->boReserved2 = this.m_boMakeWine;// 是否酿酒
            HumData->nReserved = this.m_MakeWineTime;// 酿酒的时间,即还有多长时间可以取回酒
            HumData->UnKnow[0] = (byte)n_MakeWineItmeType;// 酿酒后,应该可以得到酒的类型
            HumData->UnKnow[1] = (byte)n_MakeWineType;// 酿酒的类型 1-普通酒 2-药酒 
            HumData->UnKnow[2] = (byte)n_MakeWineQuality;// 酿酒后,应该可以得到酒的品质
            HumData->UnKnow[3] = (byte)n_MakeWineAlcohol;// 酿酒后,应该可以得到酒的酒精度
            HumData->m_btFHeroJob = this.m_btDeputyHeroJob;// 副将英雄出战职业
            TBatterPulse* pbtpl = (TBatterPulse*)HumData->HumPulses;
            pbtpl[0] = this.m_HumPulses[0];
            pbtpl[1] = this.m_HumPulses[1];
            pbtpl[2] = this.m_HumPulses[2];
            pbtpl[3] = this.m_HumPulses[3];
            HumData->BatterMagicOrder[0] = (ushort)this.m_nBatterOrder[0];// 连击技能循序
            HumData->BatterMagicOrder[1] = (ushort)this.m_nBatterOrder[1];// 连击技能循序
            HumData->BatterMagicOrder[2] = (ushort)this.m_nBatterOrder[2];// 连击技能循序
            HumItems = (TUserItem*)(HumanRcd->Data.HumItemsBuff);
            HumItems[TPosition.U_DRESS] = *this.m_UseItems[TPosition.U_DRESS];
            HumItems[TPosition.U_WEAPON] = *this.m_UseItems[TPosition.U_WEAPON];
            HumItems[TPosition.U_RIGHTHAND] = *this.m_UseItems[TPosition.U_RIGHTHAND];
            HumItems[TPosition.U_HELMET] = *this.m_UseItems[TPosition.U_NECKLACE];
            HumItems[TPosition.U_NECKLACE] = *this.m_UseItems[TPosition.U_HELMET];
            HumItems[TPosition.U_ARMRINGL] = *this.m_UseItems[TPosition.U_ARMRINGL];
            HumItems[TPosition.U_ARMRINGR] = *this.m_UseItems[TPosition.U_ARMRINGR];
            HumItems[TPosition.U_RINGL] = *this.m_UseItems[TPosition.U_RINGL];
            HumItems[TPosition.U_RINGR] = *this.m_UseItems[TPosition.U_RINGR];
            HumAddItems = (TUserItem*)(HumanRcd->Data.HumAddItemsBuff);
            HumAddItems[TPosition.U_BUJUK] = *this.m_UseItems[TPosition.U_BUJUK];
            HumAddItems[TPosition.U_BELT] = *this.m_UseItems[TPosition.U_BELT];
            HumAddItems[TPosition.U_BOOTS] = *this.m_UseItems[TPosition.U_BOOTS];
            HumAddItems[TPosition.U_CHARM] = *this.m_UseItems[TPosition.U_CHARM];
            HumAddItems[TPosition.U_ZHULI] = *this.m_UseItems[TPosition.U_ZHULI];//斗笠
            BagItems = (TUserItem*)HumanRcd->Data.BagItemsBuff;
            if (this.m_ItemList.Count > 0)
            {
                for (int i = 0; i < this.m_ItemList.Count; i++)
                {
                    if (i >= Grobal2.MAXBAGITEM)
                    {
                        break;
                    }
                    TUserItem* item = (TUserItem*)this.m_ItemList[i];
                    if (item != null)
                    {
                        if (item->wIndex == 0)  //ID为0的物品则不保存
                        {
                            continue;
                        }
                        BagItems[i] = *item;
                    }
                }
            }
            HumMagics = (THumMagic*)HumanRcd->Data.HumMagicsBuff;//普通技能
            HumNGMagics = (THumMagic*)HumanRcd->Data.HumNGMagicsBuff;//内功技能
            HumBatterMagics = (THumMagic*)HumanRcd->Data.HumBatterMagicsBuff; //连击技能
            if (this.m_MagicList.Count > 0)
            {
                int J = 0;
                int K = 0;
                int B = 0;
                for (int I = 0; I < this.m_MagicList.Count; I++)
                {
                    UserMagic = (TUserMagic*)this.m_MagicList[I];
                    if ((HUtil32.SBytePtrToString(UserMagic->MagicInfo.sDescr, UserMagic->MagicInfo.DescrLen) != "内功"))
                    {
                        if (HUtil32.SBytePtrToString(UserMagic->MagicInfo.sDescr, UserMagic->MagicInfo.DescrLen) != "连击")
                        {
                            if (J >= M2Share.MAXMAGIC)
                            {
                                continue;
                            }
                            HumMagics[J].wMagIdx = UserMagic->wMagIdx;
                            HumMagics[J].btLevel = UserMagic->btLevel;
                            HumMagics[J].btKey = UserMagic->btKey;
                            HumMagics[J].nTranPoint = UserMagic->nTranPoint;
                            J++;
                        }
                        else
                        {
                            if (B >= 4)
                            {
                                continue;
                            }
                            HumBatterMagics[B].wMagIdx = UserMagic->wMagIdx;
                            HumBatterMagics[B].btLevel = UserMagic->btLevel;
                            HumBatterMagics[B].btKey = UserMagic->btKey;
                            HumBatterMagics[B].nTranPoint = UserMagic->nTranPoint;
                            B++;
                        }
                    }
                    else
                    {
                        if (K >= M2Share.MAXMAGIC)
                        {
                            continue;
                        }
                        HumNGMagics[K].wMagIdx = UserMagic->wMagIdx;
                        HumNGMagics[K].btLevel = UserMagic->btLevel;
                        HumNGMagics[K].btKey = UserMagic->btKey;
                        HumNGMagics[K].nTranPoint = UserMagic->nTranPoint;
                        K++;
                    }
                }
            }
            StorageItems = (TUserItem*)HumanRcd->Data.StorageItemsBuff;
            if (m_StorageItemList.Count > 0)
            {
                for (int I = 0; I < m_StorageItemList.Count; I++)
                {
                    if (I >= Grobal2.MAXBAGITEM)
                    {
                        break;
                    }
                    TUserItem* item = (TUserItem*)(TUserItem*)this.m_ItemList[I];
                    if (item != null)
                    {
                        if (item->wIndex == 0)  //ID为0的物品则不保存
                        {
                            continue;
                        }
                        StorageItems[I] = *item;
                    }
                }
            }
        }

        /// <summary>
        /// 刷新人物封号
        /// </summary>
        /// <param name="nRankNo"></param>
        /// <param name="sRankName"></param>
        public void RefRankInfo(int nRankNo, string sRankName)
        {
            this.m_nGuildRankNo = nRankNo;
            this.m_sGuildRankName = sRankName;
            this.SendMsg(this, Grobal2.RM_CHANGEGUILDNAME, 0, 0, 0, 0, "");
        }

        /// <summary>
        /// 获取旧版角色属性
        /// </summary>
        /// <param name="OAbility"></param>
        private unsafe void GetOldAbil(TOAbility* OAbility)
        {
            OAbility->Level = this.m_WAbil.Level;
            OAbility->AC = HUtil32.MakeWord((byte)HUtil32._MIN(Byte.MaxValue, HUtil32.LoWord(this.m_WAbil.AC)), (byte)HUtil32._MIN(Byte.MaxValue, HUtil32.HiWord(this.m_WAbil.AC)));
            OAbility->MAC = HUtil32.MakeWord((byte)HUtil32._MIN(Byte.MaxValue, HUtil32.LoWord(this.m_WAbil.MAC)), (byte)HUtil32._MIN(Byte.MaxValue, HUtil32.HiWord(this.m_WAbil.MAC)));
            OAbility->DC = HUtil32.MakeWord((byte)HUtil32._MIN(Byte.MaxValue, HUtil32.LoWord(this.m_WAbil.DC)), (byte)HUtil32._MIN(Byte.MaxValue, HUtil32.HiWord(this.m_WAbil.DC)));
            OAbility->MC = HUtil32.MakeWord((byte)HUtil32._MIN(Byte.MaxValue, HUtil32.LoWord(this.m_WAbil.MC)), (byte)HUtil32._MIN(Byte.MaxValue, HUtil32.HiWord(this.m_WAbil.MC)));
            OAbility->SC = HUtil32.MakeWord((byte)HUtil32._MIN(Byte.MaxValue, HUtil32.LoWord(this.m_WAbil.SC)), (byte)HUtil32._MIN(Byte.MaxValue, HUtil32.HiWord(this.m_WAbil.SC)));
            OAbility->HP = this.m_WAbil.HP;
            OAbility->MP = this.m_WAbil.MP;
            OAbility->MaxHP = this.m_WAbil.MaxHP;
            OAbility->MaxMP = this.m_WAbil.MaxMP;
            OAbility->Exp = (int)this.m_WAbil.Exp;
            OAbility->MaxExp = (int)this.m_WAbil.MaxExp;
            OAbility->Weight = this.m_WAbil.Weight;
            OAbility->MaxWeight = this.m_WAbil.MaxWeight;
            OAbility->WearWeight = (byte)HUtil32._MIN(Byte.MaxValue, this.m_WAbil.WearWeight);
            OAbility->MaxWearWeight = (byte)HUtil32._MIN(Byte.MaxValue, this.m_WAbil.MaxWearWeight);
            OAbility->HandWeight = (byte)HUtil32._MIN(Byte.MaxValue, this.m_WAbil.HandWeight);
            OAbility->MaxHandWeight = (byte)HUtil32._MIN(Byte.MaxValue, this.m_WAbil.MaxHandWeight);
        }

        /// <summary>
        /// 获取攻击消息数量
        /// </summary>
        /// <returns></returns>
        public unsafe int GetHitMsgCount()
        {
            int result = 0;
            TSendMessage SendMessage = null;
            try
            {
                HUtil32.EnterCriticalSection(M2Share.ProcessMsgCriticalSection);
                if (this.m_MsgList.Count > 0)
                {
                    for (int I = 0; I < this.m_MsgList.Count; I++)
                    {
                        SendMessage = this.m_MsgList[I];// 逐日剑法  烈火 4级烈火 四级刺杀 圆月弯刀
                        if ((SendMessage.wIdent == Grobal2.CM_HIT) || (SendMessage.wIdent == Grobal2.CM_HEAVYHIT) ||
                            (SendMessage.wIdent == Grobal2.CM_BIGHIT) || (SendMessage.wIdent == Grobal2.CM_POWERHIT) ||
                            (SendMessage.wIdent == Grobal2.CM_LONGHIT) || (SendMessage.wIdent == Grobal2.CM_WIDEHIT) ||
                            (SendMessage.wIdent == Grobal2.CM_CRSHIT) || (SendMessage.wIdent == Grobal2.CM_DAILY) ||
                            (SendMessage.wIdent == Grobal2.CM_FIREHIT) || (SendMessage.wIdent == Grobal2.CM_4FIREHIT) ||
                            (SendMessage.wIdent == Grobal2.CM_4LONGHIT) || (SendMessage.wIdent == Grobal2.CM_YUANYUEHIT))
                        {
                            result++;
                        }
                    }
                }
            }
            finally
            {
                HUtil32.LeaveCriticalSection(M2Share.ProcessMsgCriticalSection);
            }
            return result;
        }

        /// <summary>
        /// 取攻击消息数量
        /// </summary>
        /// <returns></returns>
        public unsafe int GetSpellMsgCount()
        {
            int result = 0;
            TSendMessage SendMessage = null;
            try
            {
                HUtil32.EnterCriticalSection(M2Share.ProcessMsgCriticalSection);
                if (this.m_MsgList.Count > 0)
                {
                    for (int I = 0; I < this.m_MsgList.Count; I++)
                    {
                        SendMessage = this.m_MsgList[I];
                        if ((SendMessage.wIdent == Grobal2.CM_SPELL))
                        {
                            result++;
                        }
                    }
                }
            }
            finally
            {
                HUtil32.LeaveCriticalSection(M2Share.ProcessMsgCriticalSection);
            }
            return result;
        }

        public unsafe int GetRunMsgCount()
        {
            int result = 0;
            TSendMessage SendMessage = null;
            try
            {
                HUtil32.EnterCriticalSection(M2Share.ProcessMsgCriticalSection);
                if (this.m_MsgList.Count > 0)
                {
                    for (int I = 0; I < this.m_MsgList.Count; I++)
                    {
                        SendMessage = this.m_MsgList[I];
                        if ((SendMessage.wIdent == Grobal2.CM_RUN))
                        {
                            result++;
                        }
                    }
                }
            }
            finally
            {
                HUtil32.LeaveCriticalSection(M2Share.ProcessMsgCriticalSection);
            }
            return result;
        }

        public unsafe int GetWalkMsgCount()
        {
            int result = 0;
            TSendMessage SendMessage = null;
            try
            {
                HUtil32.EnterCriticalSection(M2Share.ProcessMsgCriticalSection);
                if (this.m_MsgList.Count > 0)
                {
                    for (int I = 0; I < this.m_MsgList.Count; I++)
                    {
                        SendMessage = this.m_MsgList[I];
                        if ((SendMessage.wIdent == Grobal2.CM_WALK))
                        {
                            result++;
                        }
                    }
                }
            }
            finally
            {
                HUtil32.LeaveCriticalSection(M2Share.ProcessMsgCriticalSection);
            }
            return result;
        }

        public unsafe int GetTurnMsgCount()
        {
            int result = 0;
            TSendMessage SendMessage = null;
            try
            {
                HUtil32.EnterCriticalSection(M2Share.ProcessMsgCriticalSection);
                if (this.m_MsgList.Count > 0)
                {
                    for (int I = 0; I < this.m_MsgList.Count; I++)
                    {
                        SendMessage = this.m_MsgList[I];
                        if ((SendMessage.wIdent == Grobal2.CM_TURN))
                        {
                            result++;
                        }
                    }
                }
            }
            finally
            {
                HUtil32.LeaveCriticalSection(M2Share.ProcessMsgCriticalSection);
            }
            return result;
        }

        public unsafe int GetSiteDownMsgCount()
        {
            int result = 0;
            TSendMessage SendMessage;
            HUtil32.EnterCriticalSection(M2Share.ProcessMsgCriticalSection);
            try
            {
                if (this.m_MsgList.Count > 0)
                {
                    for (int I = 0; I < this.m_MsgList.Count; I++)
                    {
                        SendMessage = this.m_MsgList[I];
                        if ((SendMessage.wIdent == Grobal2.CM_SITDOWN))
                        {
                            result++;
                        }
                    }
                }
            }
            finally
            {
                HUtil32.LeaveCriticalSection(M2Share.ProcessMsgCriticalSection);
            }
            return result;
        }

        /// <summary>
        /// 检查角色当前动作状态
        /// </summary>
        /// <param name="wIdent"></param>
        /// <param name="dwDelayTime"></param>
        /// <returns></returns>
        private bool CheckActionStatus(int wIdent, ref uint dwDelayTime)
        {
            bool result = false;
            uint dwCheckTime;
            uint dwActionIntervalTime;
            dwDelayTime = 0;// 检查人物弯腰停留时间
            if (!GameConfig.boDisableStruck)
            {
                dwCheckTime = HUtil32.GetTickCount() - this.m_dwStruckTick;
                if (GameConfig.dwStruckTime > dwCheckTime)
                {
                    dwDelayTime = GameConfig.dwStruckTime - dwCheckTime;
                    m_btOldDir = this.m_btDirection;
                    return result;
                }
            }
            // 检查二个不同操作之间所需间隔时间
            dwCheckTime = HUtil32.GetTickCount() - m_dwActionTick;
            if (m_boTestSpeedMode)
            {
                this.SysMsg("间隔: " + dwCheckTime, TMsgColor.c_Blue, TMsgType.t_Notice);
            }
            if (m_wOldIdent == wIdent)// 当二次操作一样时，则将 boFirst 设置为 真 ，退出由调用函数本身检查二个相同操作之间的间隔时间
            {
                result = true;
                return result;
            }
            if (!GameConfig.boControlActionInterval)
            {
                result = true;
                return result;
            }
            dwActionIntervalTime = m_dwActionIntervalTime;
            switch (wIdent)
            {
                case Grobal2.CM_LONGHIT:// 跑位刺杀
                    if (GameConfig.boControlRunLongHit && (m_wOldIdent == Grobal2.CM_RUN) && (m_btOldDir != this.m_btDirection))
                    {
                        dwActionIntervalTime = m_dwRunLongHitIntervalTime;
                    }
                    break;
                case Grobal2.CM_HIT:// 走位攻击
                    if (GameConfig.boControlWalkHit && (m_wOldIdent == Grobal2.CM_WALK) && (m_btOldDir != this.m_btDirection))
                    {
                        dwActionIntervalTime = m_dwWalkHitIntervalTime;
                    }
                    // 跑位攻击
                    if (GameConfig.boControlRunHit && (m_wOldIdent == Grobal2.CM_RUN) && (m_btOldDir != this.m_btDirection))
                    {
                        dwActionIntervalTime = m_dwRunHitIntervalTime;
                    }
                    break;
                case Grobal2.CM_RUN:// 跑位刺杀
                    if (GameConfig.boControlRunLongHit && (m_wOldIdent == Grobal2.CM_LONGHIT) && (m_btOldDir != this.m_btDirection))
                    {
                        dwActionIntervalTime = m_dwRunLongHitIntervalTime;
                    }
                    // 跑位攻击
                    if (GameConfig.boControlRunHit && (m_wOldIdent == Grobal2.CM_HIT) && (m_btOldDir != this.m_btDirection))
                    {
                        dwActionIntervalTime = m_dwRunHitIntervalTime;
                    }
                    // 跑位魔法
                    if (GameConfig.boControlRunMagic && (m_wOldIdent == Grobal2.CM_SPELL) && (m_btOldDir != this.m_btDirection))
                    {
                        dwActionIntervalTime = m_dwRunMagicIntervalTime;
                    }
                    break;
                case Grobal2.CM_WALK:// 走位攻击
                    if (GameConfig.boControlWalkHit && (m_wOldIdent == Grobal2.CM_HIT) && (m_btOldDir != this.m_btDirection))
                    {
                        dwActionIntervalTime = m_dwWalkHitIntervalTime;
                    }
                    // 跑位刺杀
                    if (GameConfig.boControlRunLongHit && (m_wOldIdent == Grobal2.CM_LONGHIT) && (m_btOldDir != this.m_btDirection))
                    {
                        dwActionIntervalTime = m_dwRunLongHitIntervalTime;
                    }
                    break;
                case Grobal2.CM_SPELL:// 跑位魔法
                    if (GameConfig.boControlRunMagic && (m_wOldIdent == Grobal2.CM_RUN) && (m_btOldDir != this.m_btDirection))
                    {
                        dwActionIntervalTime = m_dwRunMagicIntervalTime;
                    }
                    break;
            }
            // 将几个攻击操作合并成一个攻击操作代码 逐日剑法 烈火 4级烈火 四级刺杀 圆月弯刀
            if ((wIdent == Grobal2.CM_HIT) || (wIdent == Grobal2.CM_HEAVYHIT) || (wIdent == Grobal2.CM_BIGHIT)
                || (wIdent == Grobal2.CM_POWERHIT) || (wIdent == Grobal2.CM_WIDEHIT) || (wIdent == Grobal2.CM_CRSHIT)
                || (wIdent == Grobal2.CM_DAILY) || (wIdent == Grobal2.CM_FIREHIT) || (wIdent == Grobal2.CM_4FIREHIT) || (wIdent == Grobal2.CM_4LONGHIT) || (wIdent == Grobal2.CM_YUANYUEHIT))
            {
                wIdent = Grobal2.CM_HIT;
            }
            if (dwCheckTime >= dwActionIntervalTime)
            {
                m_dwActionTick = HUtil32.GetTickCount();
                result = true;
            }
            else
            {
                dwDelayTime = dwActionIntervalTime - dwCheckTime;
            }
            m_wOldIdent = (ushort)wIdent;
            m_btOldDir = this.m_btDirection;
            return result;
        }

        /// <summary>
        /// 添加脚本标签到列表
        /// </summary>
        /// <param name="sLabel"></param>
        public void SetScriptLabel(string sLabel)
        {
            m_CanJmpScriptLableList.Clear();
            m_CanJmpScriptLableList.Add(sLabel);
        }

        /// <summary>
        /// 取得当前脚本可以跳转的标签
        /// </summary>
        /// <param name="sMsg"></param>
        public void GetScriptLabel(string sMsg)
        {
            string sText = string.Empty;
            string sData = string.Empty;
            string sCmdStr = string.Empty;
            string sLabel = string.Empty;
            try
            {
                m_CanJmpScriptLableList.Clear();
                while (true)
                {
                    if (sMsg == "")
                    {
                        break;
                    }
                    sMsg = HUtil32.GetValidStr3(sMsg, ref sText, new string[] { "\\" });
                    if (sText != "")
                    {
                        sData = "";
                        while ((sText.IndexOf("<") > -1) && (sText.IndexOf(">") > -1) && (sText != ""))
                        {
                            if (sText[0] != '<')
                            {
                                sText = "<" + HUtil32.GetValidStr3(sText, ref sData, new string[] { "<" });
                            }
                            sText = HUtil32.ArrestStringEx(sText, "<", ">", ref sCmdStr);
                            sLabel = HUtil32.GetValidStr3(sCmdStr, ref sCmdStr, new string[] { "/" });
                            if (sLabel != "")
                            {
                                m_CanJmpScriptLableList.Add(sLabel);
                            }
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.GetScriptLabel");
            }
        }

        /// <summary>
        /// 检查标签是否存在可以跳转的列表中
        /// </summary>
        /// <param name="sLabel"></param>
        /// <returns></returns>
        public bool LableIsCanJmp(string sLabel)
        {
            bool result = false;
            if (string.Compare(sLabel, "@main", true) == 0)
            {
                result = true;
                return result;
            }
            if (m_CanJmpScriptLableList.Count > 0)
            {
                foreach (var item in m_CanJmpScriptLableList)
                {
                    if (string.Compare(sLabel, item, true) == 0)
                    {
                        result = true;
                        break;
                    }
                }
            }
            if (string.Compare(sLabel, m_sPlayDiceLabel, true) == 0)
            {
                m_sPlayDiceLabel = "";
                result = true;
                return result;
            }
            return result;
        }

        /// <summary>
        /// 刷新对象属性
        /// </summary>
        public override void RecalcAbilitys()
        {
            base.RecalcAbilitys();
            RecalcAdjusBonus();
        }

        /// <summary>
        /// 挂机后,清除相关列表
        /// </summary>
        public void ClearViewRange()
        {
            try
            {
                this.m_VisibleHumanList.Clear();
                if (this.m_VisibleItems.Count > 0)
                {
                    for (int I = 0; I < this.m_VisibleItems.Count; I++)
                    {
                        if (this.m_VisibleItems[I] != null)
                        {
                            Dispose(this.m_VisibleItems[I]);
                        }
                    }
                }
                this.m_VisibleItems.Clear();//清除物品列表
                if (this.m_VisibleActors.Count > 0)
                {
                    for (int I = 0; I < this.m_VisibleActors.Count; I++)
                    {
                        if (this.m_VisibleActors[I] != null)
                        {
                            Dispose(this.m_VisibleActors[I]);
                        }
                    }
                }
                this.m_VisibleActors.Clear(); // 清除人物列表
                if (this.m_VisibleEvents.Count > 0)
                {
                    for (int I = 0; I < this.m_VisibleEvents.Count; I++)
                    {
                        if (this.m_VisibleEvents[I] != null)
                        {
                            Dispose(this.m_VisibleEvents[I]);
                        }
                    }
                }
                this.m_VisibleEvents.Clear();//清除事件列表
            }
            catch
            {
                this.KickException();
            }
        }

        public override void SearchViewRange()
        {
            int I;
            int nStartX;
            int nEndX;
            int nStartY;
            int nEndY;
            int n18;
            int n1C;
            int nIdx;
            int n24 = 0;
            TMapCellinfo MapCellInfo = new TMapCellinfo();
            TOSObject OSObject;
            TBaseObject BaseObject;
            TMapItem MapItem;
            TEvent MapEvent;
            TVisibleMapEvent VisibleMapEvent;
            TVisibleBaseObject VisibleBaseObject;
            TVisibleMapItem VisibleMapItem;
            byte nCheckCode = 1;
            byte btType;
            int nVisibleFlag;
            const string sExceptionMsg1 = "{异常} TPlayObject::SearchViewRange Code:{0}";
            const string sExceptionMsg2 = "{异常} TPlayObject::SearchViewRange 1-{0} {1} {2} {3} {4} {5}";
            try
            {
                if (m_boNotOnlineAddExp || this.m_boDeath || this.m_boGhost)//离线挂机不搜索,死亡也不搜索
                {
                    return;
                }
                nCheckCode = 2;
                if (this.m_VisibleItems.Count > 0)
                {
                    for (I = 0; I < this.m_VisibleItems.Count; I++)
                    {
                        this.m_VisibleItems[I].nVisibleFlag = 0;
                    }
                }
                nCheckCode = 3;
                if (this.m_VisibleEvents.Count > 0)
                {
                    for (I = 0; I < this.m_VisibleEvents.Count; I++)
                    {
                        this.m_VisibleEvents[I].nVisibleFlag = 0;
                    }
                }
                nCheckCode = 4;
                if (this.m_VisibleActors.Count > 0)
                {
                    for (I = 0; I < this.m_VisibleActors.Count; I++)
                    {
                        this.m_VisibleActors[I].nVisibleFlag = 0;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage(string.Format(sExceptionMsg1, nCheckCode));
                this.KickException();
            }
            nCheckCode = 6;
            try
            {
                nStartX = this.m_nCurrX - this.m_nViewRange;
                nEndX = this.m_nCurrX + this.m_nViewRange;
                nStartY = this.m_nCurrY - this.m_nViewRange;
                nEndY = this.m_nCurrY + this.m_nViewRange;
                nCheckCode = 7;
                for (n18 = nStartX; n18 <= nEndX; n18++)
                {
                    for (n1C = nStartY; n1C <= nEndY; n1C++)
                    {
                        nCheckCode = 8;
                        if (this.m_PEnvir.GetMapCellInfo(n18, n1C, ref MapCellInfo) && (MapCellInfo.ObjList != null))
                        {
                            nCheckCode = 9;
                            n24 = 1;
                            nIdx = 0;
                            while (true)
                            {
                                if (MapCellInfo.ObjList != null)
                                {
                                    if ((MapCellInfo.ObjList != null) && (MapCellInfo.ObjList.Count <= 0))
                                    {
                                        nCheckCode = 10;
                                        MapCellInfo.ObjList = null;
                                        this.m_PEnvir.UpdateMapCellInfo(n18, n1C, MapCellInfo);
                                        nCheckCode = 101;
                                        break;
                                    }
                                }
                                nCheckCode = 11;
                                if (MapCellInfo.ObjList.Count <= nIdx)
                                {
                                    break;
                                }
                                nCheckCode = 121;
                                OSObject = MapCellInfo.ObjList[nIdx];
                                nCheckCode = 123;
                                if (OSObject != null)
                                {
                                    nCheckCode = 0;
                                    try
                                    {
                                        btType = OSObject.btType;//防止内存出错
                                    }
                                    catch
                                    {
                                        nCheckCode = 124;
                                        MapCellInfo.ObjList.RemoveAt(nIdx);
                                        nCheckCode = 125;
                                        if (MapCellInfo.ObjList.Count > 0)
                                        {
                                            continue;
                                        }
                                        nCheckCode = 126;
                                        MapCellInfo.ObjList = null;
                                        this.m_PEnvir.UpdateMapCellInfo(n18, n1C, MapCellInfo);
                                        break;
                                    }
                                    nCheckCode = 127;
                                    if (btType == Grobal2.OS_MOVINGOBJECT)
                                    {
                                        nCheckCode = 13;
                                        if ((HUtil32.GetTickCount() - OSObject.dwAddTime) >= 60000)// 60 * 1000
                                        {
                                            Dispose(OSObject);
                                            OSObject = null;
                                            MapCellInfo.ObjList.RemoveAt(nIdx);
                                            if (MapCellInfo.ObjList.Count <= 0)
                                            {
                                                MapCellInfo.ObjList = null;
                                                this.m_PEnvir.UpdateMapCellInfo(n18, n1C, MapCellInfo);
                                                break;
                                            }
                                            continue;
                                        }
                                        nCheckCode = 14;
                                        BaseObject = (TBaseObject)OSObject.CellObj;
                                        if (BaseObject != null)
                                        {
                                            if (BaseObject == this) //By John 2012.10.15 增加 如果人物坐标与地图信息坐标不一致,则删除信息
                                            {
                                                if ((this.m_nCurrX == n18) && (this.m_nCurrY == n1C))
                                                {
                                                    OSObject.dwAddTime = HUtil32.GetTickCount();
                                                    this.m_dwVerifyTick = HUtil32.GetTickCount();
                                                }
                                                else
                                                {
                                                    Dispose(OSObject);
                                                    MapCellInfo.ObjList.RemoveAt(nIdx);
                                                    if (MapCellInfo.ObjList.Count <= 0)
                                                    {
                                                        MapCellInfo.ObjList = null;
                                                        this.m_PEnvir.UpdateMapCellInfo(n18, n1C, MapCellInfo);
                                                        break;
                                                    }
                                                    continue;
                                                }
                                            }

                                            nCheckCode = 141;
                                            if (!BaseObject.m_boGhost && !BaseObject.m_boFixedHideMode && !BaseObject.m_boObMode)
                                            {
                                                nCheckCode = 15;
                                                if ((this.m_btRaceServer < Grobal2.RC_ANIMAL) || (this.m_Master != null) || this.m_boCrazyMode || this.m_boWantRefMsg
                                                    || ((BaseObject.m_Master != null) && (Math.Abs(BaseObject.m_nCurrX - this.m_nCurrX) <= 7) && (Math.Abs(BaseObject.m_nCurrY - this.m_nCurrY) <= 7))
                                                    || (BaseObject.m_btRaceServer == Grobal2.RC_PLAYOBJECT))
                                                {
                                                    nCheckCode = 16;
                                                    this.UpdateVisibleGay(BaseObject);
                                                }
                                            }
                                        }
                                    }
                                    if (this.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                                    {
                                        if ((OSObject != null))
                                        {
                                            if ((OSObject.btType == Grobal2.OS_ITEMOBJECT))
                                            {
                                                nCheckCode = 17;
                                                if ((HUtil32.GetTickCount() - OSObject.dwAddTime) > GameConfig.dwClearDropOnFloorItemTime) // 60 * 60 * 1000
                                                {
                                                    nCheckCode = 18;
                                                    if (OSObject.CellObj != null)
                                                    {
                                                        Dispose(OSObject.CellObj);
                                                        OSObject.CellObj = null;// 防止占用内存不释放现象
                                                    }
                                                    nCheckCode = 193;
                                                    if (OSObject != null)
                                                    {
                                                        nCheckCode = 192;
                                                        Dispose(OSObject);
                                                        OSObject = null;
                                                    }
                                                    nCheckCode = 20;
                                                    MapCellInfo.ObjList.RemoveAt(nIdx);
                                                    nCheckCode = 21;
                                                    if (MapCellInfo.ObjList.Count <= 0)
                                                    {
                                                        MapCellInfo.ObjList = null;
                                                        this.m_PEnvir.UpdateMapCellInfo(n18, n1C, MapCellInfo);
                                                        break;
                                                    }
                                                    continue;
                                                }
                                                MapItem = (TMapItem)OSObject.CellObj;
                                                nCheckCode = 22;
                                                this.UpdateVisibleItem(n18, n1C, MapItem);
                                                if ((MapItem.OfBaseObject != null) || (MapItem.DropBaseObject != null))
                                                {
                                                    if ((HUtil32.GetTickCount() - MapItem.dwCanPickUpTick) > GameConfig.dwFloorItemCanPickUpTime)// 2 * 60 * 1000
                                                    {
                                                        MapItem.OfBaseObject = null;
                                                        MapItem.DropBaseObject = null;
                                                    }
                                                    else
                                                    {
                                                        nCheckCode = 23;
                                                        if (((MapItem.OfBaseObject) as TBaseObject) != null)
                                                        {
                                                            if (((MapItem.OfBaseObject) as TBaseObject).m_boGhost)
                                                            {
                                                                MapItem.OfBaseObject = null;
                                                            }
                                                        }
                                                        if (((MapItem.DropBaseObject) as TBaseObject) != null)
                                                        {
                                                            if (((MapItem.DropBaseObject) as TBaseObject).m_boGhost)
                                                            {
                                                                MapItem.DropBaseObject = null;
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        if ((OSObject != null))
                                        {
                                            if ((OSObject.btType == Grobal2.OS_EVENTOBJECT))
                                            {
                                                nCheckCode = 24;
                                                if (OSObject.CellObj != null)
                                                {
                                                    MapEvent = (TEvent)OSObject.CellObj;
                                                    if (MapEvent.m_boVisible)
                                                    {
                                                        nCheckCode = 25;
                                                        this.UpdateVisibleEvent(n18, n1C, MapEvent);
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                nIdx++;
                            }
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage(string.Format(sExceptionMsg2, n24, this.m_sCharName, this.m_sMapName, this.m_nCurrX, this.m_nCurrY, nCheckCode));
                this.KickException();
            }
            nCheckCode = 26;
            n24 = 2;
            try
            {
                n18 = 0;
                while (true)
                {
                    if (this.m_VisibleActors.Count <= n18)
                    {
                        break;
                    }
                    nCheckCode = 27;
                    VisibleBaseObject = this.m_VisibleActors[n18];
                    nCheckCode = 28;
                    try
                    {
                        nVisibleFlag = VisibleBaseObject.nVisibleFlag;//防止内存出错
                    }
                    catch
                    {
                        this.m_VisibleActors.RemoveAt(n18);
                        continue;
                    }
                    if (VisibleBaseObject.nVisibleFlag == 0)
                    {
                        if (this.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                        {
                            nCheckCode = 29;
                            BaseObject = VisibleBaseObject.BaseObject;
                            nCheckCode = 30;
                            if (BaseObject != null)
                            {
                                if (!BaseObject.m_boFixedHideMode && (!BaseObject.m_boGhost)) //防止人物退出时发送重复的消息占用带宽，人物进入隐身模式时人物不消失问题
                                {
                                    nCheckCode = 31;
                                    this.SendMsg(BaseObject, Grobal2.RM_DISAPPEAR, 0, 0, 0, 0, "");
                                }
                            }
                        }
                        this.m_VisibleActors.RemoveAt(n18);
                        nCheckCode = 32;
                        Dispose(VisibleBaseObject);
                        VisibleBaseObject = null;
                        continue;
                    }
                    nCheckCode = 33;
                    if ((this.m_btRaceServer == Grobal2.RC_PLAYOBJECT) && (VisibleBaseObject.nVisibleFlag == 2))
                    {
                        nCheckCode = 34;
                        BaseObject = VisibleBaseObject.BaseObject;
                        if ((BaseObject != null))
                        {
                            if ((BaseObject != this))
                            {
                                if (!BaseObject.m_boGhost)
                                {
                                    if (BaseObject.m_boDeath)
                                    {
                                        if (BaseObject.m_boSkeleton)
                                        {
                                            nCheckCode = 35;
                                            this.SendMsg(BaseObject, Grobal2.RM_SKELETON, BaseObject.m_btDirection, BaseObject.m_nCurrX, BaseObject.m_nCurrY, 0, "");
                                        }
                                        else
                                        {
                                            nCheckCode = 36;
                                            this.SendMsg(BaseObject, Grobal2.RM_DEATH, BaseObject.m_btDirection, BaseObject.m_nCurrX, BaseObject.m_nCurrY, 0, "");
                                        }
                                    }
                                    else
                                    {
                                        nCheckCode = 37;
                                        this.SendMsg(BaseObject, Grobal2.RM_TURN, BaseObject.m_btDirection, BaseObject.m_nCurrX, BaseObject.m_nCurrY, 0, BaseObject.GetShowName());
                                        nCheckCode = 38;
                                        if ((BaseObject.m_btRaceServer == Grobal2.RC_PLAYOBJECT))
                                        {
                                            nCheckCode = 39;
                                            if (((BaseObject) as TPlayObject).m_boTrainingNG)
                                            {
                                                this.SendMsg(BaseObject, Grobal2.RM_MAGIC69SKILLNH, 0, ((BaseObject) as TPlayObject).m_Skill69NH, ((BaseObject) as TPlayObject).m_Skill69MaxNH, 0, "");
                                            }
                                        }
                                        else if ((BaseObject.m_btRaceServer == Grobal2.RC_HEROOBJECT))
                                        {
                                            nCheckCode = 41;
                                            if (((THeroObject)(BaseObject)).m_boTrainingNG)
                                            {
                                                this.SendMsg(BaseObject, Grobal2.RM_MAGIC69SKILLNH, 0, ((THeroObject)(BaseObject)).m_Skill69NH, ((THeroObject)(BaseObject)).m_Skill69MaxNH, 0, "");
                                            }
                                        }
                                        else if ((BaseObject.m_btRaceServer == Grobal2.RC_PLAYMOSTER) && (BaseObject.m_Master != null))
                                        {
                                            // 学过内功人物的分身也显示黄条值
                                            if ((BaseObject.m_Master.m_btRaceServer == Grobal2.RC_PLAYOBJECT))
                                            {
                                                if (((BaseObject.m_Master) as TPlayObject).m_boTrainingNG)
                                                {
                                                    nCheckCode = 42;
                                                    this.SendMsg(BaseObject, Grobal2.RM_MAGIC69SKILLNH, 0, ((BaseObject.m_Master) as TPlayObject).m_Skill69NH,
                                                        ((BaseObject.m_Master) as TPlayObject).m_Skill69MaxNH, 0, "");
                                                }
                                            }
                                            else if ((BaseObject.m_Master.m_btRaceServer == Grobal2.RC_HEROOBJECT))
                                            {
                                                if (((THeroObject)(BaseObject.m_Master)).m_boTrainingNG)
                                                {
                                                    nCheckCode = 43;
                                                    this.SendMsg(BaseObject, Grobal2.RM_MAGIC69SKILLNH, 0, ((THeroObject)(BaseObject.m_Master)).m_Skill69NH,
                                                        ((THeroObject)(BaseObject.m_Master)).m_Skill69MaxNH, 0, "");
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    n18++;
                }
            }
            catch
            {
                M2Share.MainOutMessage(string.Format(sExceptionMsg2, n24, this.m_sCharName, this.m_sMapName, this.m_nCurrX, this.m_nCurrY, nCheckCode));
                this.KickException();
            }
            try
            {
                I = 0;
                while (true)
                {
                    if (this.m_VisibleItems.Count <= I)
                    {
                        break;
                    }
                    VisibleMapItem = this.m_VisibleItems[I];
                    try
                    {
                        nVisibleFlag = VisibleMapItem.nVisibleFlag;//防止内存出错
                    }
                    catch
                    {
                        this.m_VisibleItems.RemoveAt(I);
                        continue;
                    }
                    nCheckCode = 38;
                    if (VisibleMapItem.nVisibleFlag == 0)
                    {
                        nCheckCode = 39;
                        this.SendMsg(this, Grobal2.RM_ITEMHIDE, 0, VisibleMapItem.MapItem.ToInt(), VisibleMapItem.nX, VisibleMapItem.nY, "");
                        nCheckCode = 40;
                        this.m_VisibleItems.RemoveAt(I);
                        nCheckCode = 41;
                        try
                        {
                            Dispose(VisibleMapItem);
                            VisibleMapItem = null;
                        }
                        catch
                        {
                            VisibleMapItem = null;
                        }
                        continue;
                    }
                    nCheckCode = 42;
                    if (VisibleMapItem.nVisibleFlag == 2)
                    {
                        this.SendMsg(this, Grobal2.RM_ITEMSHOW, VisibleMapItem.wLooks, VisibleMapItem.MapItem.ToInt(), VisibleMapItem.nX, VisibleMapItem.nY, VisibleMapItem.sName);
                    }
                    I++;
                }
                I = 0;
                while (true)
                {
                    if (this.m_VisibleEvents.Count <= I)
                    {
                        break;
                    }
                    nCheckCode = 43;
                    VisibleMapEvent = this.m_VisibleEvents[I];
                    try
                    {
                        nVisibleFlag = VisibleMapEvent.nVisibleFlag;
                    }
                    catch
                    {
                        this.m_VisibleEvents.RemoveAt(I);
                        continue;
                    }
                    nCheckCode = 44;
                    if (VisibleMapEvent.nVisibleFlag == 0)
                    {
                        nCheckCode = 45;
                        this.SendMsg(this, Grobal2.RM_HIDEEVENT, 0, VisibleMapEvent.MapEvent.ToInt(), VisibleMapEvent.nX, VisibleMapEvent.nY, "");
                        nCheckCode = 46;
                        this.m_VisibleEvents.RemoveAt(I);
                        nCheckCode = 47;
                        if (VisibleMapEvent != null)
                        {
                            Dispose(VisibleMapEvent);
                            VisibleMapEvent = null;
                        }
                        continue;
                    }
                    nCheckCode = 48;
                    if (VisibleMapEvent.nVisibleFlag == 2)
                    {
                        this.SendMsg(this, Grobal2.RM_SHOWEVENT, VisibleMapEvent.MapEvent.m_nEventType, VisibleMapEvent.MapEvent.ToInt(),
                            HUtil32.MakeLong(VisibleMapEvent.nX, VisibleMapEvent.MapEvent.m_nEventParam), VisibleMapEvent.nY, "");
                    }
                    I++;
                }
            }
            catch
            {
                M2Share.MainOutMessage(this.m_sCharName + "," + this.m_sMapName + "," + this.m_nCurrX + "," + this.m_nCurrY + ","
                    + " SearchViewRange 3 CheckCode:" + nCheckCode);
                this.KickException();
            }
        }

        /// <summary>
        /// 人物显示名字
        /// </summary>
        /// <returns></returns>
        public override string GetShowName()
        {
            string result = string.Empty;
            string sShowName;
            string sCharName;
            string sGuildName;
            string sDearName;
            string sMasterName;
            TUserCastle Castle;
            byte nCode = 0;
            try
            {
                sCharName = "";
                sGuildName = "";
                sDearName = "";
                sMasterName = "";
                nCode = 1;
                if (this.m_MyGuild != null)
                {
                    Castle = M2Share.g_CastleManager.IsCastleMember(this);
                    nCode = 2;
                    if (Castle != null)
                    {
                        sGuildName = GameMsgDef.g_sCastleGuildName.Replace("%castlename", Castle.m_sName); // 城堡名字
                        sGuildName = sGuildName.Replace("%guildname", ((TGUild)(this.m_MyGuild)).sGuildName);// 行会名字
                        sGuildName = sGuildName.Replace("%rankname", this.m_sGuildRankName);// 行会封号
                    }
                    else
                    {
                        Castle = M2Share.g_CastleManager.InCastleWarArea(this);
                        if (GameConfig.boShowGuildName || (((Castle != null) && Castle.m_boUnderWar) || this.m_boInFreePKArea))
                        {
                            sGuildName = GameMsgDef.g_sNoCastleGuildName.Replace("%guildname", ((TGUild)(this.m_MyGuild)).sGuildName);
                            sGuildName = sGuildName.Replace("%rankname", this.m_sGuildRankName);
                        }
                    }
                }
                nCode = 3;
                if (!GameConfig.boShowRankLevelName)
                {
                    nCode = 31;
                    if (m_btReLevel > 0)
                    {
                        switch (this.m_btJob)
                        {
                            case 0:
                                sCharName = GameMsgDef.g_sWarrReNewName.Replace("%chrname", this.m_sCharName);
                                break;
                            case 1:
                                sCharName = GameMsgDef.g_sWizardReNewName.Replace("%chrname", this.m_sCharName);
                                break;
                            case 2:
                                sCharName = GameMsgDef.g_sTaosReNewName.Replace("%chrname", this.m_sCharName);
                                break;
                        }
                    }
                    else
                    {
                        sCharName = this.m_sCharName;
                    }
                }
                else
                {
                    nCode = 32;
                    sCharName = string.Format(m_sRankLevelName, this.m_sCharName);
                }
                nCode = 4;
                if (m_sMasterName != "")
                {
                    if (m_boMaster)
                    {
                        sMasterName = string.Format(GameMsgDef.g_sMasterName, m_sMasterName);// '的师傅'
                    }
                    else
                    {
                        sMasterName = string.Format(GameMsgDef.g_sNoMasterName, m_sMasterName, this.MoneyToCharacter(m_nMasterNo));// '的徒弟'
                    }
                }
                nCode = 5;
                if (m_sDearName != "")
                {
                    if (this.m_btGender == 0)
                    {
                        sDearName = string.Format(GameMsgDef.g_sManDearName, m_sDearName);    // + '的丈夫';

                    }
                    else
                    {
                        sDearName = string.Format(GameMsgDef.g_sWoManDearName, m_sDearName);  // + '的妻子';
                    }
                }
                nCode = 6;
                sShowName = GameMsgDef.g_sHumanShowName.Replace("%chrname", sCharName);// 人物名
                sShowName = sShowName.Replace("%guildname", sGuildName);// 行会名
                sShowName = sShowName.Replace("%dearname", sDearName);// 夫妻名
                sShowName = sShowName.Replace("%mastername", sMasterName);// 师徒名
                result = sShowName;
                nCode = 7;
                if (GameConfig.boUnKnowHum && this.IsUsesZhuLi())
                {
                    result = "神秘人";// 带上斗笠即显示神秘人
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject::GetShowName Code:" + nCode);
            }
            return result;
        }

        /// <summary>
        /// 检查物品使用要求
        /// </summary>
        /// <param name="StdItem"></param>
        /// <returns></returns>
        private unsafe bool CheckItemsNeed(TStdItem* StdItem)
        {
            bool result = true;
            TUserCastle Castle = M2Share.g_CastleManager.IsCastleMember(this);
            switch (StdItem->Need)
            {
                case 6:
                    if ((this.m_MyGuild == null))
                    {
                        result = false;
                    }
                    break;
                case 60:
                    if ((this.m_MyGuild == null) || (this.m_nGuildRankNo != 1))
                    {
                        result = false;
                    }
                    break;
                case 7:
                    if (Castle == null)
                    {
                        result = false;
                    }
                    break;
                case 70:
                    if ((Castle == null) || (this.m_nGuildRankNo != 1))
                    {
                        result = false;
                    }
                    break;
                case 8:
                    if (m_nMemberType == 0)
                    {
                        result = false;
                    }
                    break;
                case 81:
                    if ((m_nMemberType != HUtil32.LoWord(StdItem->NeedLevel)) || (m_nMemberLevel < HUtil32.HiWord(StdItem->NeedLevel)))
                    {
                        result = false;
                    }
                    break;
                case 82:
                    if ((m_nMemberType < HUtil32.LoWord(StdItem->NeedLevel)) || (m_nMemberLevel < HUtil32.HiWord(StdItem->NeedLevel)))
                    {
                        result = false;
                    }
                    break;
            }
            return result;
        }

        /// <summary>
        /// 检查配偶
        /// </summary>
        private void CheckMarry()
        {
            bool boIsfound;
            string sUnMarryFileName;
            TStringList LoadList;
            int I;
            string sSayMsg;
            boIsfound = false;
            sUnMarryFileName = GameConfig.sEnvirDir + "UnMarry.txt";
            if (File.Exists(sUnMarryFileName))
            {
                LoadList = new TStringList();
                LoadList.LoadFromFile(sUnMarryFileName);
                for (I = LoadList.Count - 1; I >= 0; I--)
                {
                    if (LoadList.Count <= 0)
                    {
                        break;
                    }
                    if ((LoadList[I]).ToLower().CompareTo((this.m_sCharName).ToLower()) == 0)
                    {
                        LoadList.RemoveAt(I);
                        boIsfound = true;
                        break;
                    }
                }
                LoadList.SaveToFile(sUnMarryFileName);
                Dispose(LoadList);
            }
            if (boIsfound)
            {
                if (this.m_btGender == 0)
                {
                    sSayMsg = GameMsgDef.g_sfUnMarryManLoginMsg.Replace("%d", m_sDearName);
                    sSayMsg = sSayMsg.Replace("%s", m_sDearName);
                }
                else
                {
                    sSayMsg = GameMsgDef.g_sfUnMarryWoManLoginMsg.Replace("%d", this.m_sCharName);
                    sSayMsg = sSayMsg.Replace("%s", this.m_sCharName);
                }
                this.SysMsg(sSayMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                m_sDearName = "";
                this.RefShowName();
            }
            m_DearHuman = UserEngine.GetPlayObject(m_sDearName);
            if (m_DearHuman != null)
            {
                m_DearHuman.m_DearHuman = this;
                if (this.m_btGender == 0)
                {
                    sSayMsg = GameMsgDef.g_sManLoginDearOnlineSelfMsg.Replace("%d", m_sDearName);
                    sSayMsg = sSayMsg.Replace("%s", this.m_sCharName);
                    sSayMsg = sSayMsg.Replace("%m", m_DearHuman.m_PEnvir.sMapDesc);
                    sSayMsg = sSayMsg.Replace("%x", (m_DearHuman.m_nCurrX).ToString());
                    sSayMsg = sSayMsg.Replace("%y", (m_DearHuman.m_nCurrY).ToString());
                    this.SysMsg(sSayMsg, TMsgColor.c_Blue, TMsgType.t_Hint);
                    sSayMsg = GameMsgDef.g_sManLoginDearOnlineDearMsg.Replace("%d", m_sDearName);
                    sSayMsg = sSayMsg.Replace("%s", this.m_sCharName);
                    sSayMsg = sSayMsg.Replace("%m", this.m_PEnvir.sMapDesc);
                    sSayMsg = sSayMsg.Replace("%x", (this.m_nCurrX).ToString());
                    sSayMsg = sSayMsg.Replace("%y", (this.m_nCurrY).ToString());
                    m_DearHuman.SysMsg(sSayMsg, TMsgColor.c_Blue, TMsgType.t_Hint);
                }
                else
                {
                    sSayMsg = GameMsgDef.g_sWoManLoginDearOnlineSelfMsg.Replace("%d", m_sDearName);
                    sSayMsg = sSayMsg.Replace("%s", this.m_sCharName);
                    sSayMsg = sSayMsg.Replace("%m", m_DearHuman.m_PEnvir.sMapDesc);
                    sSayMsg = sSayMsg.Replace("%x", (m_DearHuman.m_nCurrX).ToString());
                    sSayMsg = sSayMsg.Replace("%y", (m_DearHuman.m_nCurrY).ToString());
                    this.SysMsg(sSayMsg, TMsgColor.c_Blue, TMsgType.t_Hint);
                    sSayMsg = GameMsgDef.g_sWoManLoginDearOnlineDearMsg.Replace("%d", m_sDearName);
                    sSayMsg = sSayMsg.Replace("%s", this.m_sCharName);
                    sSayMsg = sSayMsg.Replace("%m", this.m_PEnvir.sMapDesc);
                    sSayMsg = sSayMsg.Replace("%x", (this.m_nCurrX).ToString());
                    sSayMsg = sSayMsg.Replace("%y", (this.m_nCurrY).ToString());
                    m_DearHuman.SysMsg(sSayMsg, TMsgColor.c_Blue, TMsgType.t_Hint);
                }
            }
            else
            {
                if (this.m_btGender == 0)
                {
                    this.SysMsg(GameMsgDef.g_sManLoginDearNotOnlineMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                }
                else
                {
                    this.SysMsg(GameMsgDef.g_sWoManLoginDearNotOnlineMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                }
            }
        }

        /// <summary>
        /// 检查师傅
        /// </summary>
        private void CheckMaster()
        {
            bool boIsfound;
            string sSayMsg;
            int I;
            TPlayObject Human;
            string s01 = string.Empty;
            string s02 = string.Empty;
            string s03 = string.Empty;// 处理强行脱离师徒关系
            boIsfound = false;
            M2Share.g_UnForceMasterList.__Lock();
            try
            {
                for (I = M2Share.g_UnForceMasterList.Count - 1; I >= 0; I--)
                {
                    if (M2Share.g_UnForceMasterList.Count <= 0)
                    {
                        break;
                    }
                    s01 = M2Share.g_UnForceMasterList[I].Trim();
                    if ((s01 != "") && (s01[0] != ';'))
                    {
                        s01 = HUtil32.GetValidStr3(s01, ref s02, new string[] { " ", "\09" });// 师傅名
                        s01 = HUtil32.GetValidStr3(s01, ref s03, new string[] { " ", "\09" });// 徒弟名
                        if ((s02).ToLower().CompareTo((this.m_sCharName).ToLower()) == 0)
                        {
                            M2Share.g_UnForceMasterList.RemoveAt(I);
                            M2Share.SaveUnForceMasterList();
                            boIsfound = true;
                            break;
                        }
                    }
                }
            }
            finally
            {
                M2Share.g_UnForceMasterList.UnLock();
            }
            if (boIsfound)
            {
                if (m_boMaster)
                {
                    sSayMsg = GameMsgDef.g_sfUnMasterLoginMsg.Replace("%d", s03);//
                    DelMaster(s03);// 出师
                    if (M2Share.g_FunctionNPC != null)
                    {
                        M2Share.g_FunctionNPC.GotoLable(this, "@UnMasterEnd", false); // 师傅触发
                    }
                }
                else
                {
                    sSayMsg = GameMsgDef.g_sfUnMasterListLoginMsg.Replace("%d", m_sMasterName);
                }
                this.SysMsg(sSayMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                m_sMasterName = "";
                this.RefShowName();
            }
            if ((m_sMasterName != "") && !m_boMaster)
            {
                if (this.m_Abil.Level >= GameConfig.nMasterOKLevel)
                {
                    Human = UserEngine.GetPlayObject(m_sMasterName);
                    if ((Human != null) && (!Human.m_boDeath) && (!Human.m_boGhost))
                    {
                        sSayMsg = GameMsgDef.g_sYourMasterListUnMasterOKMsg.Replace("%d", this.MoneyToCharacter(m_nMasterNo));
                        sSayMsg = sSayMsg.Replace("%s", this.m_sCharName);
                        Human.SysMsg(sSayMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                        this.SysMsg(GameMsgDef.g_sYouAreUnMasterOKMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                        Human.DelMaster(this.m_sCharName);// 出师 20080603
                        if (this.m_sCharName == Human.m_sMasterName)// 如果大徒弟则将师父上的名字去掉
                        {
                            Human.m_sMasterName = "";
                            Human.RefShowName();
                        }
                        for (I = Human.m_MasterList.Count - 1; I >= 0; I--)
                        {
                            if (Human.m_MasterList.Count <= 0)
                            {
                                break;
                            }
                            if (Human.m_MasterList[I] == this)
                            {
                                Human.m_MasterList.RemoveAt(I);
                                break;
                            }
                        }
                        m_sMasterName = "";
                        this.RefShowName();
                        Human.m_wMasterCount++;// 增加出师徒弟数
                        Human.m_btCreditPoint += GameConfig.nMasterOKCreditPoint;// 增加师傅的声望
                        Human.m_nBonusPoint += GameConfig.nMasterOKBonusPoint;
                        Human.SendMsg(Human, Grobal2.RM_ADJUST_BONUS, 0, 0, 0, 0, "");
                    }
                    else
                    {
                        // 如果师父不在线则保存到记录表中
                        M2Share.g_UnMasterList.__Lock();
                        try
                        {
                            boIsfound = false;
                            if (M2Share.g_UnMasterList.Count > 0)
                            {
                                for (I = 0; I < M2Share.g_UnMasterList.Count; I++)
                                {
                                    s01 = M2Share.g_UnMasterList[I].Trim();
                                    if ((s01 != "") && (s01[0] != ';'))
                                    {
                                        s01 = HUtil32.GetValidStr3(s01, ref s02, new string[] { " ", "\09" });// 师傅名
                                        s01 = HUtil32.GetValidStr3(s01, ref s03, new string[] { " ", "\09" });
                                        if ((s02).ToLower().CompareTo((this.m_sCharName).ToLower()) == 0)
                                        {
                                            boIsfound = true;
                                            break;
                                        }
                                    }
                                }
                            }
                            if (!boIsfound)
                            {
                                //M2Share.g_UnMasterList.Add(m_sMasterName + " " + this.m_sCharName);
                            }
                        }
                        finally
                        {
                            M2Share.g_UnMasterList.UnLock();
                        }
                        if (!boIsfound)
                        {
                            M2Share.SaveUnMasterList();
                        }
                        this.SysMsg(GameMsgDef.g_sYouAreUnMasterOKMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                        m_sMasterName = "";
                        this.RefShowName();
                    }
                }
            }
            // 处理出师记录
            boIsfound = false;
            // M2Share.g_UnMasterList.__Lock();
            try
            {
                for (I = M2Share.g_UnMasterList.Count - 1; I >= 0; I--)
                {
                    if (M2Share.g_UnMasterList.Count <= 0)
                    {
                        break;
                    }
                    s01 = M2Share.g_UnMasterList[I].Trim();
                    if ((s01 != "") && (s01[0] != ';'))
                    {
                        // 20080603 增加
                        s01 = HUtil32.GetValidStr3(s01, ref s02, new string[] { " ", "\09" });// 师傅名
                        s01 = HUtil32.GetValidStr3(s01, ref s03, new string[] { " ", "\09" });// 徒弟名
                        if ((s02).ToLower().CompareTo((this.m_sCharName).ToLower()) == 0)
                        {
                            M2Share.g_UnMasterList.RemoveAt(I);
                            M2Share.SaveUnMasterList();
                            boIsfound = true;
                            break;
                        }
                    }
                }
            }
            finally
            {
                // M2Share.g_UnMasterList.UnLock();
            }
            if (boIsfound && m_boMaster)
            {
                sSayMsg = GameMsgDef.g_sUnMasterLoginMsg.Replace("%s", s03);
                this.SysMsg(sSayMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                DelMaster(s03);// 出师
                m_sMasterName = "";
                this.RefShowName();
                m_wMasterCount++;// 增加出师徒弟数
                m_btCreditPoint += GameConfig.nMasterOKCreditPoint;
                this.m_nBonusPoint += GameConfig.nMasterOKBonusPoint;
                this.SendMsg(this, Grobal2.RM_ADJUST_BONUS, 0, 0, 0, 0, "");
            }
            if (m_boMaster) // 是师傅
            {
                m_MasterHuman = UserEngine.GetMasterObject(this.m_sCharName); // 师父上线通知
                if (m_MasterHuman != null)
                {
                    m_MasterHuman.m_MasterHuman = this;
                    m_MasterList.Add(m_MasterHuman);
                    sSayMsg = GameMsgDef.g_sMasterOnlineSelfMsg.Replace("%d", this.MoneyToCharacter(m_nMasterNo));
                    sSayMsg = sSayMsg.Replace("%s", this.m_sCharName);
                    sSayMsg = sSayMsg.Replace("%m", m_MasterHuman.m_PEnvir.sMapDesc);
                    sSayMsg = sSayMsg.Replace("%x", (m_MasterHuman.m_nCurrX).ToString());
                    sSayMsg = sSayMsg.Replace("%y", (m_MasterHuman.m_nCurrY).ToString());
                    this.SysMsg(sSayMsg, TMsgColor.c_Blue, TMsgType.t_Hint);
                    sSayMsg = GameMsgDef.g_sMasterOnlineMasterListMsg.Replace("%d", m_sMasterName);
                    sSayMsg = sSayMsg.Replace("%s", this.m_sCharName);
                    sSayMsg = sSayMsg.Replace("%m", this.m_PEnvir.sMapDesc);
                    sSayMsg = sSayMsg.Replace("%x", (this.m_nCurrX).ToString());
                    sSayMsg = sSayMsg.Replace("%y", (this.m_nCurrY).ToString());
                    m_MasterHuman.SysMsg(sSayMsg, TMsgColor.c_Blue, TMsgType.t_Hint);
                }
                else
                {
                    if (m_MasterNoList.Count != 0)
                    {
                        this.SysMsg(GameMsgDef.g_sMasterNotOnlineMsg, TMsgColor.c_Red, TMsgType.t_Hint);// 您的徒弟现不在线
                    }
                }
            }
            else
            {
                // 徒弟上线通知
                if (m_sMasterName != "")
                {
                    m_MasterHuman = UserEngine.GetPlayObject(m_sMasterName);
                    if (m_MasterHuman != null)
                    {
                        if (m_MasterHuman.m_sMasterName == this.m_sCharName)
                        {
                            m_MasterHuman.m_MasterHuman = this;
                        }
                        m_MasterHuman.m_MasterList.Add(this);
                        sSayMsg = GameMsgDef.g_sMasterListOnlineSelfMsg.Replace("%d", m_sMasterName);
                        sSayMsg = sSayMsg.Replace("%s", this.m_sCharName);
                        sSayMsg = sSayMsg.Replace("%m", m_MasterHuman.m_PEnvir.sMapDesc);
                        sSayMsg = sSayMsg.Replace("%x", (m_MasterHuman.m_nCurrX).ToString());
                        sSayMsg = sSayMsg.Replace("%y", (m_MasterHuman.m_nCurrY).ToString());
                        this.SysMsg(sSayMsg, TMsgColor.c_Blue, TMsgType.t_Hint);
                        sSayMsg = GameMsgDef.g_sMasterListOnlineMasterMsg.Replace("%d", this.MoneyToCharacter(m_nMasterNo));
                        sSayMsg = sSayMsg.Replace("%s", this.m_sCharName);
                        sSayMsg = sSayMsg.Replace("%m", this.m_PEnvir.sMapDesc);
                        sSayMsg = sSayMsg.Replace("%x", (this.m_nCurrX).ToString());
                        sSayMsg = sSayMsg.Replace("%y", (this.m_nCurrY).ToString());
                        m_MasterHuman.SysMsg(sSayMsg, TMsgColor.c_Blue, TMsgType.t_Hint);
                    }
                    else
                    {
                        // 您的师父现不在线
                        this.SysMsg(GameMsgDef.g_sMasterListNotOnlineMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                }
            }
        }

        /// <summary>
        /// 人物下线或者死亡
        /// </summary>
        public override void MakeGhost()
        {
            string sSayMsg;
            TPlayObject Human;
            const string sExceptionMsg = "{异常} TPlayObject::MakeGhost";
            try
            {
                if ((M2Share.g_HighLevelHuman == this))
                {
                    M2Share.g_HighLevelHuman = null;
                }
                if ((M2Share.g_HighPKPointHuman == this))
                {
                    M2Share.g_HighPKPointHuman = null;
                }
                if ((M2Share.g_HighDCHuman == this))
                {
                    M2Share.g_HighDCHuman = null;
                }
                if ((M2Share.g_HighMCHuman == this))
                {
                    M2Share.g_HighMCHuman = null;
                }
                if ((M2Share.g_HighSCHuman == this))
                {
                    M2Share.g_HighSCHuman = null;
                }
                if ((M2Share.g_HighOnlineHuman == this))
                {
                    M2Share.g_HighOnlineHuman = null;
                }
                // 人物下线后通知配偶，并把对方的相关记录清空
                if (m_DearHuman != null)
                {
                    if (this.m_btGender == 0)
                    {
                        sSayMsg = GameMsgDef.g_sManLongOutDearOnlineMsg.Replace("%d", m_sDearName);
                        sSayMsg = sSayMsg.Replace("%s", this.m_sCharName);
                        sSayMsg = sSayMsg.Replace("%m", this.m_PEnvir.sMapDesc);
                        sSayMsg = sSayMsg.Replace("%x", (this.m_nCurrX).ToString());
                        sSayMsg = sSayMsg.Replace("%y", (this.m_nCurrY).ToString());
                        m_DearHuman.SysMsg(sSayMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    else
                    {
                        sSayMsg = GameMsgDef.g_sWoManLongOutDearOnlineMsg.Replace("%d", m_sDearName);
                        sSayMsg = sSayMsg.Replace("%s", this.m_sCharName);
                        sSayMsg = sSayMsg.Replace("%m", this.m_PEnvir.sMapDesc);
                        sSayMsg = sSayMsg.Replace("%x", (this.m_nCurrX).ToString());
                        sSayMsg = sSayMsg.Replace("%y", (this.m_nCurrY).ToString());
                        m_DearHuman.SysMsg(sSayMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                    m_DearHuman.m_DearHuman = null;
                    m_DearHuman = null;
                }
                if ((m_MasterHuman != null) || (m_MasterList.Count > 0))
                {
                    if (m_boMaster)
                    {
                        if (m_MasterList.Count > 0)
                        {
                            for (int I = 0; I < m_MasterList.Count; I++)
                            {
                                Human = ((m_MasterList[I]) as TPlayObject);
                                sSayMsg = GameMsgDef.g_sMasterLongOutMasterListOnlineMsg.Replace("%s", this.m_sCharName);
                                sSayMsg = sSayMsg.Replace("%m", this.m_PEnvir.sMapDesc);
                                sSayMsg = sSayMsg.Replace("%x", (this.m_nCurrX).ToString());
                                sSayMsg = sSayMsg.Replace("%y", (this.m_nCurrY).ToString());
                                Human.SysMsg(sSayMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                                Human.m_MasterHuman = null;
                            }
                        }
                    }
                    else
                    {
                        if (m_MasterHuman == null)
                        {
                            return;
                        }
                        sSayMsg = GameMsgDef.g_sMasterListLongOutMasterOnlineMsg.Replace("%d", this.MoneyToCharacter(m_nMasterNo));
                        sSayMsg = sSayMsg.Replace("%s", this.m_sCharName);
                        sSayMsg = sSayMsg.Replace("%m", this.m_PEnvir.sMapDesc);
                        sSayMsg = sSayMsg.Replace("%x", (this.m_nCurrX).ToString());
                        sSayMsg = sSayMsg.Replace("%y", (this.m_nCurrY).ToString());
                        m_MasterHuman.SysMsg(sSayMsg, TMsgColor.c_Red, TMsgType.t_Hint);// 如果为大徒弟则将对方的记录清空
                        if (m_MasterHuman.m_sMasterName == this.m_sCharName)
                        {
                            m_MasterHuman.m_MasterHuman = null;
                        }
                        for (int I = m_MasterHuman.m_MasterList.Count - 1; I >= 0; I--)
                        {
                            if (m_MasterHuman.m_MasterList.Count <= 0)
                            {
                                break;
                            }
                            if (m_MasterHuman.m_MasterList[I] == this)
                            {
                                m_MasterHuman.m_MasterList.RemoveAt(I);
                                break;
                            }
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage(sExceptionMsg);
                // MainOutMessage(E.Message);
            }
            base.MakeGhost();
        }

        /// <summary>
        /// 取玩家数据
        /// </summary>
        /// <returns></returns>
        public string GetMyInfo()
        {
            string sMyInfo;
            sMyInfo = GameMsgDef.g_sMyInfo;
            sMyInfo = sMyInfo.Replace("%name", this.m_sCharName);
            sMyInfo = sMyInfo.Replace("%map", this.m_PEnvir.sMapDesc);
            sMyInfo = sMyInfo.Replace("%x", (this.m_nCurrX).ToString());
            sMyInfo = sMyInfo.Replace("%y", (this.m_nCurrY).ToString());
            sMyInfo = sMyInfo.Replace("%level", (this.m_Abil.Level).ToString());
            sMyInfo = sMyInfo.Replace("%gold", (this.m_nGold).ToString());
            sMyInfo = sMyInfo.Replace("%pk", (this.m_nPkPoint).ToString());
            sMyInfo = sMyInfo.Replace("%minhp", (this.m_WAbil.HP).ToString());
            sMyInfo = sMyInfo.Replace("%maxhp", (this.m_WAbil.MaxHP).ToString());
            sMyInfo = sMyInfo.Replace("%minmp", (this.m_WAbil.MP).ToString());
            sMyInfo = sMyInfo.Replace("%maxmp", (this.m_WAbil.MaxMP).ToString());
            sMyInfo = sMyInfo.Replace("%mindc", (HUtil32.LoWord(this.m_WAbil.DC)).ToString());
            sMyInfo = sMyInfo.Replace("%maxdc", (HUtil32.HiWord(this.m_WAbil.DC)).ToString());
            sMyInfo = sMyInfo.Replace("%minmc", (HUtil32.LoWord(this.m_WAbil.MC)).ToString());
            sMyInfo = sMyInfo.Replace("%maxmc", (HUtil32.HiWord(this.m_WAbil.MC)).ToString());
            sMyInfo = sMyInfo.Replace("%minsc", (HUtil32.LoWord(this.m_WAbil.SC)).ToString());
            sMyInfo = sMyInfo.Replace("%maxsc", (HUtil32.HiWord(this.m_WAbil.SC)).ToString());
            sMyInfo = sMyInfo.Replace("%logontime", (m_dLogonTime).ToString());
            sMyInfo = sMyInfo.Replace("%logonlong", ((HUtil32.GetTickCount() - m_dwLogonTick) / 60000).ToString());
            return sMyInfo;
        }

        // 检查物品是当前账号的捆绑物品
        private unsafe bool CheckItemBindUse(TUserItem* UserItem)
        {
            bool result;
            int I;
            TItemBind ItemBind = null;
            result = true;
            // M2Share.g_ItemBindAccount.__Lock();
            try
            {
                if (M2Share.g_ItemBindAccount.Count > 0)
                {
                    for (I = 0; I < M2Share.g_ItemBindAccount.Count; I++)
                    {
                        ItemBind = M2Share.g_ItemBindAccount[I];
                        if (ItemBind != null)
                        {
                            if ((ItemBind.nMakeIdex == UserItem->MakeIndex) && (ItemBind.nItemIdx == UserItem->wIndex))
                            {
                                result = false;
                                if (((ItemBind.sBindName).ToLower().CompareTo((m_sUserID).ToLower()) == 0))
                                {
                                    result = true;
                                }
                                else
                                {
                                    this.SysMsg(GameMsgDef.g_sItemIsNotThisAccount, TMsgColor.c_Red, TMsgType.t_Hint);
                                }
                                return result;
                            }
                        }
                    }
                }
            }
            finally
            {
                //M2Share.g_ItemBindAccount.UnLock();
            }
            //M2Share.g_ItemBindIPaddr.__Lock();
            try
            {
                if (M2Share.g_ItemBindIPaddr.Count > 0)
                {
                    for (I = 0; I < M2Share.g_ItemBindIPaddr.Count; I++)
                    {
                        ItemBind = M2Share.g_ItemBindIPaddr[I];
                        if (ItemBind != null)
                        {
                            if ((ItemBind.nMakeIdex == UserItem->MakeIndex) && (ItemBind.nItemIdx == UserItem->wIndex))
                            {
                                result = false;
                                if (((ItemBind.sBindName).ToLower().CompareTo((m_sIPaddr).ToLower()) == 0))
                                {
                                    result = true;
                                }
                                else
                                {
                                    this.SysMsg(GameMsgDef.g_sItemIsNotThisIPaddr, TMsgColor.c_Red, TMsgType.t_Hint);
                                }
                                return result;
                            }
                        }
                    }
                }
            }
            finally
            {
                // M2Share.g_ItemBindIPaddr.UnLock();
            }
            // M2Share.g_ItemBindCharName.__Lock();
            try
            {
                if (M2Share.g_ItemBindCharName.Count > 0)
                {
                    for (I = 0; I < M2Share.g_ItemBindCharName.Count; I++)
                    {
                        //ItemBind = M2Share.g_ItemBindCharName[I];
                        if (ItemBind != null)
                        {
                            if ((ItemBind.nMakeIdex == UserItem->MakeIndex) && (ItemBind.nItemIdx == UserItem->wIndex))
                            {
                                result = false;
                                if (((ItemBind.sBindName).ToLower().CompareTo((this.m_sCharName).ToLower()) == 0))
                                {
                                    result = true;
                                }
                                else
                                {
                                    this.SysMsg(GameMsgDef.g_sItemIsNotThisCharName, TMsgColor.c_Red, TMsgType.t_Hint);
                                }
                                return result;
                            }
                        }
                    }
                }
            }
            finally
            {
                //M2Share.g_ItemBindCharName.UnLock();
            }
            return result;
        }

        private void ProcessClientPassword(TProcessMessage ProcessMsg)
        {
            int nLen;
            string sData;
            if (ProcessMsg.wParam == 0)
            {
                ProcessUserLineMsg("@" + M2Share.g_GameCommand.UnLock.sCmd);
                return;
            }
            sData = ProcessMsg.sMsg;
            nLen = sData.Length;
            if (m_boSetStoragePwd)
            {
                m_boSetStoragePwd = false;
                if ((nLen > 3) && (nLen < 8))
                {
                    m_sTempPwd = sData;
                    m_boReConfigPwd = true;
                    this.SysMsg(GameMsgDef.g_sReSetPasswordMsg, TMsgColor.c_Green, TMsgType.t_Hint);// '请重复输入一次仓库密码：'
                    this.SendMsg(this, Grobal2.RM_PASSWORD, 0, 0, 0, 0, "");
                }
                else
                {
                    this.SysMsg(GameMsgDef.g_sPasswordOverLongMsg, TMsgColor.c_Red, TMsgType.t_Hint);// '输入的密码长度不正确！！！，密码长度必须在 4 - 7 的范围内，请重新设置密码。'
                }
                return;
            }
            if (m_boReConfigPwd)
            {
                m_boReConfigPwd = false;
                if (m_sTempPwd.CompareTo(sData) == 0)
                {
                    m_sStoragePwd = sData;
                    m_boPasswordLocked = true;
                    m_sTempPwd = "";
                    this.SysMsg(GameMsgDef.g_sReSetPasswordOKMsg, TMsgColor.c_Blue, TMsgType.t_Hint);// '密码设置成功！！，仓库已经自动上锁，请记好您的仓库密码，在取仓库时需要使用此密码开锁。'
                }
                else
                {
                    m_sTempPwd = "";
                    this.SysMsg(GameMsgDef.g_sReSetPasswordNotMatchMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                }
                return;
            }
            if (m_boUnLockPwd || m_boUnLockStoragePwd)
            {
                if (m_sStoragePwd.CompareTo(sData) == 0)
                {
                    m_boPasswordLocked = false;
                    if (m_boUnLockPwd)
                    {
                        if (GameConfig.boLockDealAction)
                        {
                            m_boCanDeal = true;
                        }
                        if (GameConfig.boLockDropAction)
                        {
                            m_boCanDrop = true;
                        }
                        if (GameConfig.boLockWalkAction)
                        {
                            m_boCanWalk = true;
                        }
                        if (GameConfig.boLockRunAction)
                        {
                            m_boCanRun = true;
                        }
                        if (GameConfig.boLockHitAction)
                        {
                            m_boCanHit = true;
                        }
                        if (GameConfig.boLockSpellAction)
                        {
                            m_boCanSpell = true;
                        }
                        if (GameConfig.boLockCallHeroAction)
                        {
                            m_boCallHero = true;
                        }
                        // 是否锁定召唤英雄操作
                        if (GameConfig.boLockSendMsgAction)
                        {
                            m_boCanSendMsg = true;
                        }
                        if (GameConfig.boLockUserItemAction)
                        {
                            m_boCanUseItem = true;
                        }
                        if (GameConfig.boLockInObModeAction)
                        {
                            this.m_boObMode = false;
                            this.m_boAdminMode = false;
                        }
                        m_boLockLogoned = true;
                        this.SysMsg(GameMsgDef.g_sPasswordUnLockOKMsg, TMsgColor.c_Blue, TMsgType.t_Hint);
                    }
                    if (m_boUnLockStoragePwd)
                    {
                        if (GameConfig.boLockGetBackItemAction)
                        {
                            m_boCanGetBackItem = true;
                        }
                        this.SysMsg(GameMsgDef.g_sStorageUnLockOKMsg, TMsgColor.c_Blue, TMsgType.t_Hint);
                    }
                }
                else
                {
                    m_btPwdFailCount++;
                    this.SysMsg(GameMsgDef.g_sUnLockPasswordFailMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                    if (m_btPwdFailCount > 3)
                    {
                        this.SysMsg(GameMsgDef.g_sStoragePasswordLockedMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                }
                m_boUnLockPwd = false;
                m_boUnLockStoragePwd = false;
                return;
            }
            if (m_boCheckOldPwd)
            {
                m_boCheckOldPwd = false;
                if (m_sStoragePwd == sData)
                {
                    this.SendMsg(this, Grobal2.RM_PASSWORD, 0, 0, 0, 0, "");
                    this.SysMsg(GameMsgDef.g_sSetPasswordMsg, TMsgColor.c_Green, TMsgType.t_Hint);
                    m_boSetStoragePwd = true;
                }
                else
                {
                    m_btPwdFailCount++;
                    this.SysMsg(GameMsgDef.g_sOldPasswordIncorrectMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                    if (m_btPwdFailCount > 3)
                    {
                        this.SysMsg(GameMsgDef.g_sStoragePasswordLockedMsg, TMsgColor.c_Red, TMsgType.t_Hint);
                        m_boPasswordLocked = true;
                    }
                }
                return;
            }
        }

        /// <summary>
        /// 人物死亡掉背包物品
        /// </summary>
        /// <param name="ItemOfCreat"></param>
        public unsafe override void ScatterBagItems(TBaseObject ItemOfCreat)
        {
            int DropWide;
            TUserItem* pu;
            List<string> DelList = null;
            bool boDropall;
            string sCheckItemName;
            TStdItem* StdItem;
            const string sExceptionMsg = "{异常} TPlayObject::ScatterBagItems";
            m_boCanQueryBag = true;// 死亡掉背包时,不能�           }
            if (this.m_PEnvir.m_boNODROPITEM) // 地图禁止死亡掉物品则退出
            {
                return;
            }
            boDropall = false;
            DropWide = 2;
            if (GameConfig.boDieRedScatterBagAll && (this.PKLevel() >= 2))// 非红名掉1/3 //红名全掉
            {
                boDropall = true;
            }
            try
            {
                for (int I = this.m_ItemList.Count - 1; I >= 0; I--)
                {
                    if (this.m_ItemList.Count <= 0)
                    {
                        break;
                    }
                    if (boDropall || (HUtil32.Random(GameConfig.nDieScatterBagRate) == 0))
                    {
                        if (this.m_ItemList[I] != null)
                        {
                            pu = ((TUserItem*)(this.m_ItemList[I]));
                            sCheckItemName = UserEngine.GetStdItemName(pu->wIndex);
                            if (this.PlugOfCheckCanItem(6, sCheckItemName, false, 0, 0)) // 禁止物品规则(永不爆出)
                            {
                                continue;
                            }
                            if (CheckItemBindDieNoDrop((TUserItem*)this.m_ItemList[I]))// 人物装备绑定死亡不爆
                            {
                                continue;
                            }
                            StdItem = UserEngine.GetStdItem(pu->wIndex);
                            if (StdItem != null)
                            {
                                if ((StdItem->StdMode == 51) && (StdItem->Shape == 0) && (pu->Dura > 0) && (pu->btValue[20] == 1))// 是聚灵珠
                                {
                                    n_UsesItemTick = 0;  // 时间初始
                                    pu->btValue[12] = 2; // 不能聚集的标识
                                }
                            }
                            if (this.DropItemDown(((TUserItem*)(this.m_ItemList[I])), DropWide, true, true, ItemOfCreat, this))
                            {
                                if (this.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                                {
                                    if (DelList == null)
                                    {
                                        DelList = new List<string>();
                                    }
                                    //DelList.Add(UserEngine.GetStdItemName(pu.wIndex), ((pu.MakeIndex) as Object));
                                }
                                Marshal.FreeHGlobal((IntPtr)this.m_ItemList[I]);
                                this.m_ItemList.RemoveAt(I);
                            }
                        }
                    }
                }
                if (DelList != null)
                {
                    this.SendMsg(this, Grobal2.RM_SENDDELITEMLIST, 0, HUtil32.ObjectToInt(DelList), 0, 0, "");
                }
            }
            catch
            {
                M2Share.MainOutMessage(sExceptionMsg);
            }
            finally
            {
                m_boCanQueryBag = false;// 死亡掉背包时,不能刷新包裹
            }
        }

        /// <summary>
        /// 召唤人物
        /// </summary>
        /// <param name="sHumName"></param>
        public void RecallHuman(string sHumName)
        {
            int nX = 0;
            int nY = 0;
            int n18 = 0;
            int n1C = 0;
            TPlayObject PlayObject = UserEngine.GetPlayObject(sHumName);
            if (PlayObject != null)
            {
                if (this.GetFrontPosition(ref nX, ref nY))
                {
                    if (this.sub_4C5370(nX, nY, 3, ref n18, ref n1C))
                    {
                        PlayObject.SendRefMsg(Grobal2.RM_SPACEMOVE_FIRE, 0, 0, 0, 0, "");
                        PlayObject.SpaceMove(this.m_sMapName, n18, n1C, 0);
                    }
                }
                else
                {
                    this.SysMsg("召唤失败！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                }
            }
            else
            {
                this.SysMsg(string.Format(GameMsgDef.g_sNowNotOnLineOrOnOtherServer, sHumName), TMsgColor.c_Red, TMsgType.t_Hint);
            }
        }

        /// <summary>
        /// 申请行会战
        /// </summary>
        /// <param name="sGuildName"></param>
        public void ReQuestGuildWar(string sGuildName)
        {
            TGUild Guild;
            TWarGuild WarGuild;
            bool boReQuestOK;
            if (!this.IsGuildMaster())
            {
                this.SysMsg("只有行会掌门人才能申请！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            if (M2Share.nServerIndex != 0)
            {
                this.SysMsg("这个命令不能在本服务器上使用！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            Guild = GuildManager.FindGuild(sGuildName);
            if (Guild == null)
            {
                this.SysMsg("行会不存在！！！", TMsgColor.c_Red, TMsgType.t_Hint);
                return;
            }
            boReQuestOK = false;
            WarGuild = ((TGUild)(this.m_MyGuild)).AddWarGuild(Guild);
            if (WarGuild != null)
            {
                if (Guild.AddWarGuild(((TGUild)(this.m_MyGuild))) == null)
                {
                    WarGuild.dwWarTick = 0;
                }
                else
                {
                    boReQuestOK = true;
                }
            }
            if (boReQuestOK)
            {
                UserEngine.SendServerGroupMsg(Grobal2.SS_207, M2Share.nServerIndex, ((TGUild)(this.m_MyGuild)).sGuildName);
                UserEngine.SendServerGroupMsg(Grobal2.SS_207, M2Share.nServerIndex, Guild.sGuildName);
            }
        }

        private bool CheckDenyLogon()
        {
            bool result = false;
            if (M2Share.GetDenyIPaddrList(m_sIPaddr))
            {
                this.SysMsg(GameMsgDef.g_sYourIPaddrDenyLogon, TMsgColor.c_Red, TMsgType.t_Hint);
                result = true;
            }
            else if (M2Share.GetDenyAccountList(m_sUserID))
            {
                this.SysMsg(GameMsgDef.g_sYourAccountDenyLogon, TMsgColor.c_Red, TMsgType.t_Hint);
                result = true;
            }
            else if (M2Share.GetDenyChrNameList(this.m_sCharName))
            {
                this.SysMsg(GameMsgDef.g_sYourCharNameDenyLogon, TMsgColor.c_Red, TMsgType.t_Hint);
                result = true;
            }
            if (result)
            {
                m_boEmergencyClose = true;
                m_boPlayOffLine = false;
            }
            return result;
        }

        public bool IsGotoLabel_GetAllowItem(string sItemName1, string sItemName2)
        {
            bool result;
            result = false;
            if (sItemName1 == "*")
            {
                result = true;
            }
            else if ((sItemName1).ToLower().CompareTo((sItemName2).ToLower()) == 0)
            {
                result = true;
            }
            return result;
        }

        public bool IsGotoLabel_GetRandomCount(int nRandomCount)
        {
            bool result;
            result = false;
            if (nRandomCount == 0)
            {
                result = true;
            }
            else if ((nRandomCount > 0) && (HUtil32.Random(nRandomCount / 2 + nRandomCount) == nRandomCount))
            {
                result = true;
            }
            return result;
        }

        public bool IsGotoLabel_GetGroup(bool boNeedGroup)
        {
            bool result;
            result = false;
            if (!boNeedGroup)
            {
                result = true;
            }
            else if (m_GroupOwner != null)
            {
                result = true;
            }
            return result;
        }

        /// <summary>
        /// 是否跳转标签
        /// </summary>
        /// <param name="sMapName"></param>
        /// <param name="nX"></param>
        /// <param name="nY"></param>
        /// <param name="nRange"></param>
        /// <param name="nQuestFalgStatus"></param>
        /// <param name="boQuestFalgStatus"></param>
        /// <param name="sItemName1"></param>
        /// <param name="sItemName2"></param>
        /// <param name="boNeedGroup"></param>
        /// <param name="nRandomCount"></param>
        /// <returns></returns>
        public bool IsGotoLabel(string sMapName, int nX, int nY, int nRange, int nQuestFalgStatus, bool boQuestFalgStatus, string sItemName1, string sItemName2, bool boNeedGroup, int nRandomCount)
        {
            bool result;
            int n01;
            int nMaxCurrX;
            int nMaxCurrY;
            int nMinCurrX;
            int nMinCurrY;
            result = false;
            nMaxCurrX = nX + nRange;
            nMaxCurrY = nY + nRange;
            nMinCurrX = nX - nRange;
            nMinCurrY = nY - nRange;
            if (((sMapName).ToLower().CompareTo((this.m_sMapName).ToLower()) == 0) && (this.m_nCurrX <= nMaxCurrX) && (this.m_nCurrX >= nMinCurrX)
                && (this.m_nCurrY <= nMaxCurrY) && (this.m_nCurrY >= nMinCurrY))
            {
                if (nQuestFalgStatus > 0)
                {
                    n01 = this.GetQuestFalgStatus(nQuestFalgStatus);
                    if ((n01 == 0) && !boQuestFalgStatus)
                    {
                        if (IsGotoLabel_GetAllowItem(sItemName1, sItemName2) && IsGotoLabel_GetGroup(boNeedGroup) && IsGotoLabel_GetRandomCount(nRandomCount))
                        {
                            result = true;
                        }
                    }
                    else if ((n01 != 0) && boQuestFalgStatus)
                    {
                        if (IsGotoLabel_GetAllowItem(sItemName1, sItemName2) && IsGotoLabel_GetGroup(boNeedGroup) && IsGotoLabel_GetRandomCount(nRandomCount))
                        {
                            result = true;
                        }
                    }
                }
                else
                {
                    if (IsGotoLabel_GetAllowItem(sItemName1, sItemName2) && IsGotoLabel_GetGroup(boNeedGroup) && IsGotoLabel_GetRandomCount(nRandomCount))
                    {
                        result = true;
                    }
                }
            }
            return result;
        }

        /// <summary>
        /// 地图事件触发-掉落物品
        /// </summary>
        /// <param name="sItemName"></param>
        public void StartMapEventOfDropItem(string sItemName)
        {
            bool boGotoLabel;
            TMapEvent MapEvent;
            byte nCode = 0;
            try
            {
                nCode = 0;
                MapEvent = null;
                boGotoLabel = false;
                if (M2Share.g_MapEventListOfDropItem.Count > 0)
                {
                    nCode = 1;
                    for (int I = 0; I < M2Share.g_MapEventListOfDropItem.Count; I++)
                    {
                        nCode = 2;
                        MapEvent = ((TMapEvent)(M2Share.g_MapEventListOfDropItem[I]));
                        nCode = 3;
                        if (MapEvent != null)
                        {
                            nCode = 4;
                            if (IsGotoLabel(MapEvent.m_sMapName, MapEvent.m_nCurrX, MapEvent.m_nCurrY, MapEvent.m_nRange, MapEvent.m_MapFlag.nQuestUnit, MapEvent.m_MapFlag.boOpen,
                                MapEvent.m_Condition.sItemName, sItemName, MapEvent.m_Condition.boNeedGroup, MapEvent.m_nRandomCount))
                            {
                                boGotoLabel = true;
                                break;
                            }
                        }
                    }
                }
                if (boGotoLabel && (MapEvent != null))
                {
                    switch (MapEvent.m_StartScript.nLable)
                    {
                        case 0:
                            break;
                        case 1:
                            if (M2Share.g_FunctionNPC != null)
                            {
                                nCode = 5;
                                M2Share.g_FunctionNPC.GotoLable(this, MapEvent.m_StartScript.sLable, false);
                            }
                            break;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.StartMapEventOfDropItem Code:" + (nCode).ToString());
            }
        }

        /// <summary>
        /// 地图事件触发-捡起物品
        /// </summary>
        /// <param name="sItemName"></param>
        public void StartMapEventOfPickUpItem(string sItemName)
        {
            bool boGotoLabel;
            TMapEvent MapEvent;
            byte nCode = 0;
            try
            {
                nCode = 0;
                MapEvent = null;
                boGotoLabel = false;
                nCode = 1;
                if (M2Share.g_MapEventListOfPickUpItem.Count > 0)
                {
                    nCode = 2;
                    for (int I = 0; I < M2Share.g_MapEventListOfPickUpItem.Count; I++)
                    {
                        nCode = 3;
                        MapEvent = ((TMapEvent)(M2Share.g_MapEventListOfPickUpItem[I]));
                        nCode = 4;
                        if (MapEvent != null)
                        {
                            nCode = 5;
                            if (IsGotoLabel(MapEvent.m_sMapName, MapEvent.m_nCurrX, MapEvent.m_nCurrY, MapEvent.m_nRange, MapEvent.m_MapFlag.nQuestUnit, MapEvent.m_MapFlag.boOpen,
                                MapEvent.m_Condition.sItemName, sItemName, MapEvent.m_Condition.boNeedGroup, MapEvent.m_nRandomCount))
                            {
                                boGotoLabel = true;
                                break;
                            }
                        }
                    }
                }
                if (boGotoLabel && (MapEvent != null))
                {
                    switch (MapEvent.m_StartScript.nLable)
                    {
                        case 0:
                            break;
                        case 1:
                            if (M2Share.g_FunctionNPC != null)
                            {
                                nCode = 6;
                                M2Share.g_FunctionNPC.GotoLable(this, MapEvent.m_StartScript.sLable, false);
                            }
                            break;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.StartMapEventOfPickUpItem Code:" + (nCode).ToString());
            }
        }

        /// <summary>
        /// 地图事件触发-挖矿
        /// </summary>
        public void StartMapEventOfMine()
        {
            bool boGotoLabel;
            TMapEvent MapEvent;
            byte nCode = 0;
            try
            {
                nCode = 0;
                MapEvent = null;
                boGotoLabel = false;
                nCode = 1;
                if (M2Share.g_MapEventListOfMine.Count > 0)
                {
                    nCode = 2;
                    for (int I = 0; I < M2Share.g_MapEventListOfMine.Count; I++)
                    {
                        nCode = 3;
                        MapEvent = ((TMapEvent)(M2Share.g_MapEventListOfMine[I]));
                        nCode = 4;
                        if (MapEvent != null)
                        {
                            nCode = 5;
                            if (IsGotoLabel(MapEvent.m_sMapName, MapEvent.m_nCurrX, MapEvent.m_nCurrY, MapEvent.m_nRange, MapEvent.m_MapFlag.nQuestUnit, MapEvent.m_MapFlag.boOpen,
                                MapEvent.m_Condition.sItemName, "*", MapEvent.m_Condition.boNeedGroup, MapEvent.m_nRandomCount))
                            {
                                boGotoLabel = true;
                                break;
                            }
                        }
                    }
                }
                if (boGotoLabel && (MapEvent != null))
                {
                    switch (MapEvent.m_StartScript.nLable)
                    {
                        case 0:
                            break;
                        case 1:
                            if (M2Share.g_FunctionNPC != null)
                            {
                                nCode = 6;
                                M2Share.g_FunctionNPC.GotoLable(this, MapEvent.m_StartScript.sLable, false);
                            }
                            break;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.StartMapEventOfMine Code:" + (nCode).ToString());
            }
        }

        /// <summary>
        /// 地图事件触发-走路
        /// </summary>
        public void StartMapEventOfWalk()
        {
            bool boGotoLabel;
            TMapEvent MapEvent;
            byte nCode = 0;
            try
            {
                nCode = 0;
                MapEvent = null;
                boGotoLabel = false;
                nCode = 1;
                if (M2Share.g_MapEventListOfWalk.Count > 0)
                {
                    nCode = 2;
                    for (int I = 0; I < M2Share.g_MapEventListOfWalk.Count; I++)
                    {
                        nCode = 3;
                        MapEvent = M2Share.g_MapEventListOfWalk[I];
                        nCode = 4;
                        if (MapEvent != null)
                        {
                            nCode = 5;
                            if (IsGotoLabel(MapEvent.m_sMapName, MapEvent.m_nCurrX, MapEvent.m_nCurrY, MapEvent.m_nRange, MapEvent.m_MapFlag.nQuestUnit, MapEvent.m_MapFlag.boOpen,
                                MapEvent.m_Condition.sItemName, "*", MapEvent.m_Condition.boNeedGroup, MapEvent.m_nRandomCount))
                            {
                                boGotoLabel = true;
                                break;
                            }
                        }
                    }
                }
                if (boGotoLabel && (MapEvent != null))
                {
                    switch (MapEvent.m_StartScript.nLable)
                    {
                        case 0:
                            break;
                        case 1:
                            if (M2Share.g_FunctionNPC != null)
                            {
                                nCode = 6;
                                M2Share.g_FunctionNPC.GotoLable(this, MapEvent.m_StartScript.sLable, false);
                            }
                            break;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.StartMapEventOfWalk nCode:" + (nCode).ToString());
            }
        }

        /// <summary>
        /// 地图事件触发-走
        /// </summary>
        public void StartMapEventOfRun()
        {
            bool boGotoLabel;
            TMapEvent MapEvent;
            byte nCode = 0;
            try
            {
                nCode = 0;
                MapEvent = null;
                boGotoLabel = false;
                nCode = 1;
                if (M2Share.g_MapEventListOfRun.Count > 0)
                {
                    nCode = 2;
                    for (int I = 0; I < M2Share.g_MapEventListOfRun.Count; I++)
                    {
                        nCode = 3;
                        MapEvent = M2Share.g_MapEventListOfRun[I];
                        nCode = 4;
                        if (MapEvent != null)
                        {
                            nCode = 5;
                            if (IsGotoLabel(MapEvent.m_sMapName, MapEvent.m_nCurrX, MapEvent.m_nCurrY, MapEvent.m_nRange, MapEvent.m_MapFlag.nQuestUnit, MapEvent.m_MapFlag.boOpen,
                                MapEvent.m_Condition.sItemName, "*", MapEvent.m_Condition.boNeedGroup, MapEvent.m_nRandomCount))
                            {
                                boGotoLabel = true;
                                break;
                            }
                        }
                    }
                }
                if (boGotoLabel && (MapEvent != null))
                {
                    switch (MapEvent.m_StartScript.nLable)
                    {
                        case 0:
                            break;
                        case 1:
                            if (M2Share.g_FunctionNPC != null)
                            {
                                nCode = 6;
                                M2Share.g_FunctionNPC.GotoLable(this, MapEvent.m_StartScript.sLable, false);
                            }
                            break;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.StartMapEventOfRun Code:" + (nCode).ToString());
            }
        }

        /// <summary>
        /// 处理自定义命令事件
        /// </summary>
        /// <param name="sParam1"></param>
        /// <param name="sParam2"></param>
        /// <param name="sParam3"></param>
        /// <param name="sParam4"></param>
        /// <param name="sParam5"></param>
        /// <param name="sParam6"></param>
        /// <param name="sParam7"></param>
        public void ProcessUserCmd(string sParam1, string sParam2, string sParam3, string sParam4, string sParam5, string sParam6, string sParam7)
        {
            this.SysMsg(sParam2, TMsgColor.c_Green, TMsgType.t_Hint);
        }

        // 增加祝福罐.魔令包功能
        public unsafe bool WearDragon()
        {
            bool result = false;
            TStdItem* StdItem;
            if (this.m_UseItems[TPosition.U_BUJUK]->wIndex > 0)  // 修改成下面那段,以支持祝福罐.魔令包功
            {
                StdItem = UserEngine.GetStdItem(this.m_UseItems[TPosition.U_BUJUK]->wIndex);// 去掉除泉水罐外
                if ((StdItem != null) && (StdItem->StdMode == 2) && (StdItem->AniCount == 21))// 修改 StdItem->Shape=3  StdItem->Reserved=56为泉水罐
                {
                    result = true;// 祝福罐.魔令包
                }
            }
            return result;
        }

        /// <summary>
        /// 修补祝福罐.魔令包
        /// </summary>
        /// <param name="btType">2--主人  4--英雄</param>
        /// <param name="nItemIdx"></param>
        /// <param name="sItemName"></param>
        public unsafe void RepairDragon(byte btType, int nItemIdx, string sItemName)
        {
            int n14;
            TUserItem* UserItem;
            TStdItem* StdItem;
            TStdItem* StdItem1;
            string sUserItemName;
            bool boRepairOK;
            IList<IntPtr> ItemList;
            int OldDura;
            boRepairOK = false;
            ItemList = null;
            StdItem = null;
            StdItem1 = null;
            UserItem = null;
            OldDura = 0;
            n14 = -1;
            if (WearDragon())
            {
                if (this.m_UseItems[TPosition.U_BUJUK]->Dura < this.m_UseItems[TPosition.U_BUJUK]->DuraMax)
                {
                    OldDura = this.m_UseItems[TPosition.U_BUJUK]->Dura;
                    switch (btType)
                    {
                        case 2:
                            ItemList = this.m_Master.m_ItemList;
                            break;
                        case 4:
                            ItemList = this.m_ItemList;
                            break;
                    }
                    if (ItemList != null)
                    {
                        if (ItemList.Count > 0)
                        {
                            for (int I = 0; I < ItemList.Count; I++)
                            {
                                UserItem = (TUserItem*)ItemList[I];
                                if ((UserItem != null) && (UserItem->MakeIndex == nItemIdx))
                                {
                                    // 取自定义物品名称
                                    sUserItemName = "";
                                    if (UserItem->btValue[13] == 1)
                                    {
                                        sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                                    }
                                    if (sUserItemName == "")
                                    {
                                        sUserItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                                    }
                                    StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                                    if (StdItem != null)
                                    {
                                        if ((sUserItemName).ToLower().CompareTo((sItemName).ToLower()) == 0)
                                        {
                                            n14 = I;
                                            StdItem1 = UserEngine.GetStdItem(this.m_UseItems[TPosition.U_BUJUK]->wIndex);
                                            break;
                                        }
                                    }
                                }
                                UserItem = null;
                            }
                        }
                        // 存的物品的外观要对罐的Source属性,罐物品的Shape=放入物品的StdMode ,衣服武器不能存
                        if ((StdItem != null) && (UserItem != null) && (StdItem->Shape == StdItem1->Source) && (StdItem->StdMode == StdItem1->Shape) &&
                            (!(new ArrayList(new int[] { 5, 6, 10, 11 }).Contains(StdItem->StdMode))))
                        {
                            this.m_UseItems[TPosition.U_BUJUK]->Dura += 1000;
                            if (this.m_UseItems[TPosition.U_BUJUK]->Dura > this.m_UseItems[TPosition.U_BUJUK]->DuraMax)
                            {
                                this.m_UseItems[TPosition.U_BUJUK]->Dura = this.m_UseItems[TPosition.U_BUJUK]->DuraMax;
                            }
                            boRepairOK = true;
                            switch (btType)
                            {
                                case 2:
                                    this.m_Master.DelBagItem(n14);
                                    break;
                                case 4:
                                    this.DelBagItem(n14);
                                    break;
                            }
                        }
                    }
                }
            }
            if (boRepairOK)
            {
                if (OldDura != this.m_UseItems[TPosition.U_BUJUK]->Dura)
                {
                    this.SendMsg(this, Grobal2.RM_DURACHANGE, TPosition.U_BUJUK, this.m_UseItems[TPosition.U_BUJUK]->Dura, this.m_UseItems[TPosition.U_BUJUK]->DuraMax, 0, "");
                }
                SendDefMessage(Grobal2.SM_REPAIRDRAGON_OK, btType, 0, 0, 0, "");
            }
            else
            {
                SendDefMessage(Grobal2.SM_REPAIRDRAGON_FAIL, btType, 0, 0, 0, "");
            }
        }

        // -----------------------------------宝箱系统-----------------------------------
        // 判断宝箱和钥匙是否对应
        // str为客户端传来的钥匙makeidx
        public unsafe void ClientSendBoxItem(int BoxsIdx, string str)
        {
            int I;
            TUserItem* UserItem;
            TStdItem* StdItemBox;
            TStdItem* StdItemKey;
            int KeysIdx;
            StdItemBox = null;
            StdItemKey = null;
            KeysIdx = Convert.ToInt32(str.Trim());
            if (!this.m_boDeath)
            {
                if (IsEnoughBag())
                {
                    // 包裹不满时
                    if (this.m_ItemList.Count > 0)
                    {
                        for (I = this.m_ItemList.Count - 1; I >= 0; I--)
                        {
                            if (this.m_ItemList.Count <= 0)
                            {
                                break;
                            }
                            UserItem = (TUserItem*)this.m_ItemList[I];
                            if (UserItem == null)
                            {
                                continue;
                            }
                            if ((UserItem != null) && (UserItem->MakeIndex == BoxsIdx))
                            {
                                // 得到宝箱
                                StdItemBox = UserEngine.GetStdItem(UserItem->wIndex);
                                if ((StdItemBox != null) && (StdItemBox->StdMode == 48))
                                {
                                    break;
                                }
                            }
                        }
                        for (I = this.m_ItemList.Count - 1; I >= 0; I--)
                        {
                            if (this.m_ItemList.Count <= 0)
                            {
                                break;
                            }
                            UserItem = (TUserItem*)this.m_ItemList[I];
                            if (UserItem == null)
                            {
                                continue;
                            }
                            if ((UserItem != null) && (UserItem->MakeIndex == KeysIdx))
                            {
                                // 得到钥匙
                                StdItemKey = UserEngine.GetStdItem(UserItem->wIndex);
                                if ((StdItemKey != null) && (StdItemKey->StdMode == 49))
                                {
                                    break;
                                }
                            }
                        }
                    }
                    if ((StdItemBox != null) && (StdItemKey != null) && (StdItemBox->AniCount == StdItemKey->Shape))
                    {
                        // 宝箱和钥匙对应,则打开宝箱,删除物品
                        if (ClientOpenBoxs(StdItemBox->Source))
                        {
                            // 宝箱开启
                            for (I = this.m_ItemList.Count - 1; I >= 0; I--)
                            {
                                // 删除物品
                                if (this.m_ItemList.Count <= 0)
                                {
                                    break;
                                }
                                UserItem = (TUserItem*)this.m_ItemList[I];
                                if (UserItem == null)
                                {
                                    continue;
                                }
                                if ((UserItem != null))
                                {
                                    if ((UserItem->MakeIndex == BoxsIdx))
                                    {
                                        if (StdItemBox->NeedIdentify == 1)
                                        {
                                            M2Share.AddGameDataLog("11" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString() + "\09" + (this.m_nCurrY).ToString() + "\09" + this.m_sCharName
                                                + "\09" + HUtil32.SBytePtrToString(StdItemBox->Name, 0, StdItemBox->NameLen) + "\09" + (UserItem->MakeIndex).ToString() + "\09" + "(开宝箱)" + "\09" + "0");
                                        }
                                        this.m_ItemList.RemoveAt(I);
                                    }
                                    else if ((UserItem->MakeIndex == KeysIdx))
                                    {
                                        if (StdItemKey->NeedIdentify == 1)
                                        {
                                            M2Share.AddGameDataLog("11" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString() + "\09" + (this.m_nCurrY).ToString() + "\09" + this.m_sCharName
                                                + "\09" + HUtil32.SBytePtrToString(StdItemBox->Name, 0, StdItemBox->NameLen) + "\09" + (UserItem->MakeIndex).ToString() + "\09" + "(开宝箱)" + "\09" + "0");
                                        }
                                        this.m_ItemList.RemoveAt(I);
                                    }
                                }
                            }
                        }
                        else
                        {
                            this.SendMsg(this, Grobal2.RM_OPENBOXS_FAIL, 0, 0, 0, 0, "");// 失败
                            this.SysMsg("开启宝箱失败!", TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                    }
                    else
                    {
                        this.SendMsg(this, Grobal2.RM_OPENBOXS_FAIL, 0, 0, 0, 0, "");// 失败
                        this.SysMsg("您的宝箱和钥匙不对应,不能打开宝箱!", TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                }
                else
                {
                    this.SendMsg(this, Grobal2.RM_OPENBOXS_FAIL, 0, 0, 0, 0, "");// 失败
                    this.SysMsg("您的包裹已满,不能开启宝箱!", TMsgColor.c_Red, TMsgType.t_Hint);
                }
            }
        }

        // 判断宝箱和钥匙是否对应
        // 宝箱开启,随机取出9件物品
        public bool ClientOpenBoxs(int SBoxsID)
        {
            bool result;
            IList<IntPtr> vList1;
            IList<IntPtr> vList2;
            IList<IntPtr> vList3;
            IList<IntPtr> vList4;
            int I;
            int T;
            TBoxsInfo BoxsInfo;
            TBoxsInfo BoxsInfo1;
            string sSendStr;
            result = false;
            sSendStr = "";
            byte[] data;
            if (M2Share.BoxsList == null)
            {
                return result;
            }
            if (m_boOpenBox)// 如果有宝箱正在操作,则退出,一次只能开一个宝箱
            {
                return result;
            }
            n_OpenBox = 0;
            n_IncUsesGameGold = 0;
            n_IncUsesGold = 0;
            n_BoxsItmeID = 0;// 初始化给人物物品的ID
            vList1 = new List<IntPtr>();
            vList2 = new List<IntPtr>();
            vList3 = new List<IntPtr>();
            vList4 = new List<IntPtr>();
            try
            {
                if (M2Share.BoxsList.Count > 0)
                {
                    //    for (T = 0; T < M2Share.BoxsList.Count; T++)
                    //    {
                    //        BoxsInfo1 = M2Share.BoxsList[T];
                    //        if (BoxsInfo1.SBoxsID != SBoxsID)
                    //        {
                    //            continue;
                    //        }
                    //        switch (BoxsInfo1.nItemType) // 如果不是Source对应的txt文件则跳过
                    //        {
                    //            case 0:
                    //                vList3.Add((IntPtr)BoxsInfo1); // 物品类型 0 的写入vList3
                    //                break;
                    //            case 1:
                    //                vList2.Add((IntPtr)BoxsInfo1);// 物品类型 1 的写入vList2
                    //                break;
                    //            case 2:
                    //                vList1.Add((IntPtr)BoxsInfo1); // 物品类型 2 的写入vList1
                    //                break;
                    //            case 3:
                    //                vList4.Add((IntPtr)BoxsInfo1);// 物品类型 3 的写入vList4
                    //                break;
                    //        }
                    //    }
                    //}
                    //// 要求,类型为2的要有最少1件,1的最少要有2件,0的最少要有4件,3的最少要2件,    分开取,使显示的位置不同 20080606
                    //if ((vList1.Count > 0) && (vList2.Count > 1) && (vList3.Count > 4) && (vList4.Count > 1))
                    //{
                    //    m_Boxs.Clear();
                    //    switch (HUtil32.Random(2))
                    //    {
                    //        case 0:
                    //            // 第一种显示方式
                    //            I = HUtil32.Random(vList3.Count);
                    //            // 物品类型为0的1条记录
                    //            BoxsInfo1 = ((TBoxsInfo*)(vList3[I]));
                    //            BoxsInfo = BoxsInfo1;
                    //            m_Boxs.Add((IntPtr)BoxsInfo1);// 保存随机取出的宝箱物品
                    //            data = new byte[sizeof(TBoxsInfo)];
                    //            fixed (byte* pb = data)
                    //            {
                    //                *(TBoxsInfo*)pb = *BoxsInfo;
                    //            }
                    //            sSendStr = sSendStr + EncryptUnit.EncodeBuffer(data, sizeof(TBoxsInfo)) + "/";
                    //            vList3.RemoveAt(I);// 抽取完后从临时列表中删除数据
                    //            I = HUtil32.Random(vList2.Count);// 物品类型为1
                    //            BoxsInfo1 = ((TBoxsInfo*)(vList2[I]));
                    //            BoxsInfo = BoxsInfo1;
                    //            m_Boxs.Add((IntPtr)BoxsInfo1);// 保存随机取出的宝箱物品
                    //            data = new byte[sizeof(TBoxsInfo)];
                    //            fixed (byte* pb = data)
                    //            {
                    //                *(TBoxsInfo*)pb = *BoxsInfo;
                    //            }
                    //            sSendStr = sSendStr + EncryptUnit.EncodeBuffer(data, sizeof(TBoxsInfo)) + "/";
                    //            vList2.RemoveAt(I);// 抽取完后从临时列表中删除数据
                    //            I = HUtil32.Random(vList3.Count);// 物品类型为0的1条记录
                    //            BoxsInfo1 = ((TBoxsInfo*)(vList3[I]));
                    //            BoxsInfo = BoxsInfo1;
                    //            m_Boxs.Add((IntPtr)BoxsInfo1);// 保存随机取出的宝箱物品
                    //            data = new byte[sizeof(TBoxsInfo)];
                    //            fixed (byte* pb = data)
                    //            {
                    //                *(TBoxsInfo*)pb = *BoxsInfo;
                    //            }
                    //            sSendStr = sSendStr + EncryptUnit.EncodeBuffer(data, sizeof(TBoxsInfo)) + "/";
                    //            vList3.RemoveAt(I);// 抽取完后从临时列表中删除数据
                    //            I = HUtil32.Random(vList4.Count);// 物品类型为3
                    //            BoxsInfo1 = ((TBoxsInfo*)(vList4[I]));
                    //            BoxsInfo = BoxsInfo1;
                    //            m_Boxs.Add((IntPtr)BoxsInfo1);// 保存随机取出的宝箱物品
                    //            data = new byte[sizeof(TBoxsInfo)];
                    //            fixed (byte* pb = data)
                    //            {
                    //                *(TBoxsInfo*)pb = *BoxsInfo;
                    //            }
                    //            sSendStr = sSendStr + EncryptUnit.EncodeBuffer(data, sizeof(TBoxsInfo)) + "/";
                    //            vList4.RemoveAt(I);// 抽取完后从临时列表中删除数据
                    //            I = HUtil32.Random(vList3.Count);// 物品类型为0的1条记录
                    //            BoxsInfo1 = ((TBoxsInfo*)(vList3[I]));
                    //            BoxsInfo = BoxsInfo1;
                    //            m_Boxs.Add((IntPtr)BoxsInfo1);// 保存随机取出的宝箱物品
                    //            data = new byte[sizeof(TBoxsInfo)];
                    //            fixed (byte* pb = data)
                    //            {
                    //                *(TBoxsInfo*)pb = *BoxsInfo;
                    //            }
                    //            sSendStr = sSendStr + EncryptUnit.EncodeBuffer(data, sizeof(TBoxsInfo)) + "/";
                    //            vList3.RemoveAt(I);// 抽取完后从临时列表中删除数据
                    //            I = HUtil32.Random(vList2.Count);// 物品类型为1
                    //            BoxsInfo1 = ((TBoxsInfo*)(vList2[I]));
                    //            BoxsInfo = BoxsInfo1;
                    //            m_Boxs.Add((IntPtr)BoxsInfo1);// 保存随机取出的宝箱物品
                    //            data = new byte[sizeof(TBoxsInfo)];
                    //            fixed (byte* pb = data)
                    //            {
                    //                *(TBoxsInfo*)pb = *BoxsInfo;
                    //            }
                    //            sSendStr = sSendStr + EncryptUnit.EncodeBuffer(data, sizeof(TBoxsInfo)) + "/";
                    //            vList2.RemoveAt(I);// 抽取完后从临时列表中删除数据
                    //            I = HUtil32.Random(vList3.Count);// 物品类型为0的1条记录
                    //            BoxsInfo1 = ((TBoxsInfo*)(vList3[I]));
                    //            BoxsInfo = BoxsInfo1;
                    //            m_Boxs.Add((IntPtr)BoxsInfo1);// 保存随机取出的宝箱物品
                    //            data = new byte[sizeof(TBoxsInfo)];
                    //            fixed (byte* pb = data)
                    //            {
                    //                *(TBoxsInfo*)pb = *BoxsInfo;
                    //            }
                    //            sSendStr = sSendStr + EncryptUnit.EncodeBuffer(data, sizeof(TBoxsInfo)) + "/";
                    //            vList3.RemoveAt(I);// 抽取完后从临时列表中删除数据
                    //            I = HUtil32.Random(vList4.Count);// 物品类型为3
                    //            BoxsInfo1 = ((TBoxsInfo*)(vList4[I]));
                    //            BoxsInfo = BoxsInfo1;
                    //            m_Boxs.Add((IntPtr)BoxsInfo1);// 保存随机取出的宝箱物品
                    //            data = new byte[sizeof(TBoxsInfo)];
                    //            fixed (byte* pb = data)
                    //            {
                    //                *(TBoxsInfo*)pb = *BoxsInfo;
                    //            }
                    //            sSendStr = sSendStr + EncryptUnit.EncodeBuffer(data, sizeof(TBoxsInfo)) + "/";
                    //            vList4.RemoveAt(I);// 抽取完后从临时列表中删除数据
                    //            break;
                    //        case 1:// 第二种显示方式
                    //            I = HUtil32.Random(vList2.Count);// 物品类型为1
                    //            BoxsInfo1 = ((TBoxsInfo*)(vList2[I]));
                    //            BoxsInfo = BoxsInfo1;
                    //            m_Boxs.Add((IntPtr)BoxsInfo1);// 保存随机取出的宝箱物品
                    //            data = new byte[sizeof(TBoxsInfo)];
                    //            fixed (byte* pb = data)
                    //            {
                    //                *(TBoxsInfo*)pb = *BoxsInfo;
                    //            }
                    //            sSendStr = sSendStr + EncryptUnit.EncodeBuffer(data, sizeof(TBoxsInfo)) + "/";
                    //            vList2.RemoveAt(I);// 抽取完后从临时列表中删除数据
                    //            I = HUtil32.Random(vList3.Count);// 物品类型为0的1条记录
                    //            BoxsInfo1 = ((TBoxsInfo*)(vList3[I]));
                    //            BoxsInfo = BoxsInfo1;
                    //            m_Boxs.Add((IntPtr)BoxsInfo1);// 保存随机取出的宝箱物品
                    //            data = new byte[sizeof(TBoxsInfo)];
                    //            fixed (byte* pb = data)
                    //            {
                    //                *(TBoxsInfo*)pb = *BoxsInfo;
                    //            }
                    //            sSendStr = sSendStr + EncryptUnit.EncodeBuffer(data, sizeof(TBoxsInfo)) + "/";
                    //            vList3.RemoveAt(I);// 抽取完后从临时列表中删除数据
                    //            I = HUtil32.Random(vList4.Count);// 物品类型为3
                    //            BoxsInfo1 = ((TBoxsInfo*)(vList4[I]));
                    //            BoxsInfo = BoxsInfo1;
                    //            m_Boxs.Add((IntPtr)BoxsInfo1);// 保存随机取出的宝箱物品
                    //            data = new byte[sizeof(TBoxsInfo)];
                    //            fixed (byte* pb = data)
                    //            {
                    //                *(TBoxsInfo*)pb = *BoxsInfo;
                    //            }
                    //            sSendStr = sSendStr + EncryptUnit.EncodeBuffer(data, sizeof(TBoxsInfo)) + "/";
                    //            vList4.RemoveAt(I);// 抽取完后从临时列表中删除数据
                    //            I = HUtil32.Random(vList3.Count);// 物品类型为0的1条记录
                    //            BoxsInfo1 = ((TBoxsInfo*)(vList3[I]));
                    //            BoxsInfo = BoxsInfo1;
                    //            m_Boxs.Add((IntPtr)BoxsInfo1);// 保存随机取出的宝箱物品
                    //            data = new byte[sizeof(TBoxsInfo)];
                    //            fixed (byte* pb = data)
                    //            {
                    //                *(TBoxsInfo*)pb = *BoxsInfo;
                    //            }
                    //            sSendStr = sSendStr + EncryptUnit.EncodeBuffer(data, sizeof(TBoxsInfo)) + "/";
                    //            vList3.RemoveAt(I);// 抽取完后从临时列表中删除数据
                    //            I = HUtil32.Random(vList2.Count);// 物品类型为1
                    //            BoxsInfo1 = ((TBoxsInfo*)(vList2[I]));
                    //            BoxsInfo = BoxsInfo1;
                    //            m_Boxs.Add((IntPtr)BoxsInfo1);// 保存随机取出的宝箱物品
                    //            data = new byte[sizeof(TBoxsInfo)];
                    //            fixed (byte* pb = data)
                    //            {
                    //                *(TBoxsInfo*)pb = *BoxsInfo;
                    //            }
                    //            sSendStr = sSendStr + EncryptUnit.EncodeBuffer(data, sizeof(TBoxsInfo)) + "/";
                    //            vList2.RemoveAt(I);// 抽取完后从临时列表中删除数据
                    //            I = HUtil32.Random(vList3.Count);// 物品类型为0的1条记录
                    //            BoxsInfo1 = ((TBoxsInfo*)(vList3[I]));
                    //            BoxsInfo = BoxsInfo1;
                    //            m_Boxs.Add((IntPtr)BoxsInfo1);// 保存随机取出的宝箱物品
                    //            data = new byte[sizeof(TBoxsInfo)];
                    //            fixed (byte* pb = data)
                    //            {
                    //                *(TBoxsInfo*)pb = *BoxsInfo;
                    //            }
                    //            sSendStr = sSendStr + EncryptUnit.EncodeBuffer(data, sizeof(TBoxsInfo)) + "/";
                    //            vList3.RemoveAt(I);// 抽取完后从临时列表中删除数据
                    //            I = HUtil32.Random(vList4.Count);// 物品类型为3
                    //            BoxsInfo1 = ((TBoxsInfo*)(vList4[I]));
                    //            BoxsInfo = BoxsInfo1;
                    //            m_Boxs.Add((IntPtr)BoxsInfo1);// 保存随机取出的宝箱物品
                    //            data = new byte[sizeof(TBoxsInfo)];
                    //            fixed (byte* pb = data)
                    //            {
                    //                *(TBoxsInfo*)pb = *BoxsInfo;
                    //            }
                    //            sSendStr = sSendStr + EncryptUnit.EncodeBuffer(data, sizeof(TBoxsInfo)) + "/";
                    //            vList4.RemoveAt(I);// 抽取完后从临时列表中删除数据
                    //            I = HUtil32.Random(vList3.Count);// 物品类型为0的1条记录
                    //            BoxsInfo1 = ((TBoxsInfo*)(vList3[I]));
                    //            BoxsInfo = BoxsInfo1;
                    //            m_Boxs.Add((IntPtr)BoxsInfo1);// 保存随机取出的宝箱物品
                    //            data = new byte[sizeof(TBoxsInfo)];
                    //            fixed (byte* pb = data)
                    //            {
                    //                *(TBoxsInfo*)pb = *BoxsInfo;
                    //            }
                    //            sSendStr = sSendStr + EncryptUnit.EncodeBuffer(data, sizeof(TBoxsInfo)) + "/";
                    //            vList3.RemoveAt(I); // 抽取完后从临时列表中删除数据
                    //            break;
                    //    }
                    //    I = HUtil32.Random(vList1.Count);// 取出一条物品类型为2的数据
                    //    BoxsInfo1 = ((TBoxsInfo*)(vList1[I]));
                    //    BoxsInfo = BoxsInfo1;
                    //    n_BoxsItmeID = BoxsInfo->StdItem.MakeIndex;// 得到中间物品的ID
                    //    data = new byte[sizeof(TBoxsInfo)];
                    //    fixed (byte* pb = data)
                    //    {
                    //        *(TBoxsInfo*)pb = *BoxsInfo;
                    //    }
                    //    sSendStr = sSendStr + EncryptUnit.EncodeBuffer(data, sizeof(TBoxsInfo)) + "/";
                    //    m_Boxs.Add((IntPtr)BoxsInfo1);// 保存随机取出的宝箱物品
                }
            }
            finally
            {
                Dispose(vList1);
                Dispose(vList2);
                Dispose(vList3);
            }
            if (sSendStr != "")
            {
                this.SendMsg(this, Grobal2.RM_OPENBOXS, 0, 0, 0, 0, sSendStr);
                m_boOpenBox = true;// 宝箱正在打开中
                result = true;
            }
            return result;
        }

        public unsafe int ClientGetBoxs_GetItemID(List<TBoxsInfo> BoxS, int ItemType)
        {
            int result;
            TBoxsInfo pBoxsInfo;
            IList<TBoxsInfo> sTemp;
            result = 0;
            sTemp = new List<TBoxsInfo>();
            int T;
            if (BoxS.Count > 0)
            {
                for (int I = 0; I < BoxS.Count; I++)
                {
                    pBoxsInfo = BoxS[I];
                    if (pBoxsInfo.nItemType != ItemType)
                    {
                        continue;
                    }
                    sTemp.Add(pBoxsInfo);
                }
            }
            if (sTemp.Count > 0)
            {
                for (int I = 0; I < sTemp.Count; I++)
                {
                    T = HUtil32.Random(sTemp.Count);
                    pBoxsInfo = sTemp[T];
                    result = pBoxsInfo.StdItem->MakeIndex;
                    if (result != 0)
                    {
                        break;
                    }
                }
            }
            Dispose(sTemp);
            return result;
        }

        // 宝箱类型,即Source
        // 打开宝箱
        // 转动宝箱,随机给客户端一件物品,并减少一定的金币或元宝
        public void ClientGetBoxs()
        {
            int I;
            TBoxsInfo BoxsInfo1;
            int UsesGold;
            int UsesGameGold;
            bool OpenBox_OK;// 打开宝箱是否成功
            OpenBox_OK = false;
            UsesGold = 0;
            UsesGameGold = 0;
            try
            {
                if ((m_Boxs == null) || (m_Boxs.Count == 0))
                {
                    return;
                }
                n_BoxsItmeID = 0;
                n_OpenBox++;// 开宝箱记数
                I = HUtil32.Random(m_Boxs.Count);
                BoxsInfo1 = m_Boxs[I];
                if (n_OpenBox == 1) // 免费转动一次
                {
                    UsesGold = BoxsInfo1.nGold;// 转动所需的金币数
                    UsesGameGold = (int)BoxsInfo1.nGameGold;// 转动所需的元宝数
                    n_BoxsItmeID = ClientGetBoxs_GetItemID(m_Boxs, 0);
                    OpenBox_OK = true;
                }
                else
                {
                    // 收费转动
                    if (!(n_OpenBox > BoxsInfo1.nUses))// 没有超过最大使用次数
                    {
                        UsesGold = (BoxsInfo1.nGold + BoxsInfo1.nIncGold * (n_OpenBox - 2));// 转动所需的金币数   [起始值+累计值*(次数-2)]
                        UsesGameGold = Convert.ToInt32(BoxsInfo1.nGameGold + BoxsInfo1.nIncGameGold * (n_OpenBox - 2));// 转动所需的元宝数
                        if ((this.m_nGold >= UsesGold) && (m_nGameGold >= UsesGameGold))
                        {
                            this.m_nGold -= UsesGold;
                            m_nGameGold -= UsesGameGold;
                            n_IncUsesGold += UsesGold;
                            n_IncUsesGameGold += UsesGameGold;
                            this.GoldChanged();// 更新客户端金币
                            this.GameGoldChanged();// 更新客户端元宝
                            OpenBox_OK = true;// 物消费总值大于或等于有效金币数和元宝数,则给玩家 不可得的物品
                            if ((n_IncUsesGold >= BoxsInfo1.nEffectiveGold) && (n_IncUsesGameGold >= BoxsInfo1.nEffectiveGameGold))
                            {
                                n_BoxsItmeID = ClientGetBoxs_GetItemID(m_Boxs, 1);
                            }
                            else
                            {
                                n_BoxsItmeID = ClientGetBoxs_GetItemID(m_Boxs, 0);
                            }
                        }
                        else
                        {
                            // 人物的金币或元宝数不足
                            this.SysMsg("您的金币或元宝数不足,不能再转动宝箱!", TMsgColor.c_Red, TMsgType.t_Hint);
                        }
                    }
                    else
                    {
                        // 超过最大使用次数
                        this.SysMsg("宝箱已无法再使用!", TMsgColor.c_Red, TMsgType.t_Hint);
                    }
                }
                if (OpenBox_OK) // 发消息给客户端
                {
                    if (n_OpenBox == 1)
                    {
                        this.SendMsg(this, Grobal2.RM_MOVEBOXS, 0, n_BoxsItmeID, UsesGold, UsesGameGold, "");
                    }
                    else
                    {
                        this.SendMsg(this, Grobal2.RM_MOVEBOXS, 0, n_BoxsItmeID, (BoxsInfo1.nGold + BoxsInfo1.nIncGold * (n_OpenBox - 1)),
                            (int)(BoxsInfo1.nGameGold + BoxsInfo1.nIncGameGold * (n_OpenBox - 1)), "");
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject::ClientGetBoxs");
            }
        }

        /// <summary>
        /// 宝箱给玩家物品
        /// </summary>
        public unsafe void ClientGetBoxsItme()
        {
            int I;
            uint ItemNum;
            TUserItem* UserItem = null;
            TStdItem* StdItem;
            TBoxsInfo* BoxsInfo = null;
            string ItemName = string.Empty;
            string sCheckItemName;
            string szString;
            if (!m_boOpenBox)
            {
                return;
            }
            try
            {
                m_boOpenBox = false;
                ItemNum = 0;
                if (n_BoxsItmeID != 0)
                {
                    if (M2Share.BoxsList.Count > 0)
                    {
                        for (I = 0; I < M2Share.BoxsList.Count; I++)
                        {
                            BoxsInfo = (TBoxsInfo*)M2Share.BoxsList[I];
                            if (BoxsInfo->StdItem->MakeIndex == n_BoxsItmeID)
                            {
                                ItemName = HUtil32.SBytePtrToString(BoxsInfo->StdItem->s.Name, 0, BoxsInfo->StdItem->s.NameLen);// 物品名称
                                ItemNum = (uint)BoxsInfo->nItemNum;// 物品数量
                            }
                            if (ItemName != "")
                            {
                                break;
                            }
                        }
                    }
                    StdItem = UserEngine.GetStdItem(ItemName);
                    if ((StdItem != null))
                    {
                        if (ItemNum <= 0)
                        {
                            ItemNum = 1;
                        }
                        for (I = 0; I < ItemNum; I++)
                        {
                            // 支持物品的多数量获取
                            UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                            if (UserEngine.CopyToUserItemFromName(HUtil32.SBytePtrToString(StdItem->Name, 0, StdItem->NameLen), UserItem))
                            {
                                UserItem->Dura = (ushort)BoxsInfo->StdItem->Dura;
                                if (IsEnoughBag() && this.IsAddWeightAvailable(StdItem->Weight))  // 包裹有位置则放到包裹里,没有则扔出物品
                                {
                                    this.m_ItemList.Add((IntPtr)UserItem);
                                    if (StdItem->NeedIdentify == 1)
                                    {
                                        M2Share.AddGameDataLog("40" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString() + "\09" + (this.m_nCurrY).ToString() + "\09" + this.m_sCharName + "\09"
                                            + HUtil32.SBytePtrToString(StdItem->Name, 0, StdItem->NameLen) + "\09" + (UserItem->MakeIndex).ToString() + "\09" + "(" + (HUtil32.LoWord(StdItem->DC)).ToString() + "/" + (HUtil32.HiWord(StdItem->DC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MC)).ToString()
                                            + "/" + (HUtil32.HiWord(StdItem->MC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->SC)).ToString() + "/" + (HUtil32.HiWord(StdItem->SC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->AC)).ToString() +
                                            "/" + (HUtil32.HiWord(StdItem->AC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MAC)).ToString() + "/" + (HUtil32.HiWord(StdItem->MAC)).ToString() + ")" + (UserItem->btValue[0]).ToString() + "/"
                                            + (UserItem->btValue[1]).ToString() + "/" + (UserItem->btValue[2]).ToString() + "/" + (UserItem->btValue[3]).ToString() + "/" + (UserItem->btValue[4]).ToString() + "/"
                                            + (UserItem->btValue[5]).ToString() + "/" + (UserItem->btValue[6]).ToString() + "/" + (UserItem->btValue[7]).ToString() + "/" + (UserItem->btValue[8]).ToString() + "/"
                                            + (UserItem->btValue[14]).ToString() + "\09" + "0");
                                    }
                                    if (this.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                                    {
                                        SendAddItem(UserItem);
                                        SendUpdateItem(UserItem);// 更新物品
                                        sCheckItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                                        this.PlugOfCheckCanItem(5, sCheckItemName, false, 0, 0);// 禁止物品规则(管理插件功能) 20080729
                                    }
                                }
                                else
                                {
                                    // 扔出物品
                                    this.DropItemDown(UserItem, 3, false, false, this, this);
                                }
                            }
                            else
                            {
                                Marshal.FreeHGlobal((IntPtr)UserItem);
                                break;
                            }
                        }
                        // UserEngine.SendBroadCastMsgExt('系统：恭喜玩家 '+m_sCharName+' 开启宝箱获得'+inttostr(ItemNum)+'件【'+HUtil32.SBytePtrToString(StdItem->Name,0,StdItem->NameLen)+'】', t_Say);//向每个人物发送消息
                    }
                    else
                    {
                        // 不是数据库里的物品
                        if ((ItemName.Trim()).ToLower().CompareTo(("经验").ToLower()) == 0)
                        {
                            GetExpToItem(ItemNum);// 取得的经验,累积到聚灵珠
                            if (m_MyHero != null)
                            {
                                //((THeroObject)(m_MyHero)).GetExp(Math.Abs(HUtil32.Round((GameConfig.nHeroNoKillMonExpRate / 100) * ItemNum)));
                                ItemNum = (uint)Math.Abs((int)HUtil32.Round((double)((100 - GameConfig.nHeroNoKillMonExpRate) / 100) * ItemNum, 1));
                            }
                            if (this.m_Abil.Exp >= (uint)ItemNum)
                            {
                                if ((uint.MaxValue - this.m_Abil.Exp) < (uint)ItemNum)
                                {
                                    ItemNum = Convert.ToUInt32(uint.MaxValue - this.m_Abil.Exp);
                                }
                            }
                            else
                            {
                                if ((uint.MaxValue - (uint)ItemNum) < this.m_Abil.Exp)
                                {
                                    ItemNum = Convert.ToUInt32(uint.MaxValue - (uint)ItemNum);
                                }
                            }
                            m_GetExp = (uint)ItemNum;// 人物取得的经验,$GetExp变量使用
                            if (M2Share.g_FunctionNPC != null) // 取经验触发
                            {
                                M2Share.g_FunctionNPC.GotoLable(this, "@GetExp", false);
                            }
                            this.m_Abil.Exp += (uint)ItemNum;
                            this.SendMsg(this, Grobal2.RM_WINEXP, 0, ItemNum, 0, 0, "");
                        }
                        else if ((ItemName.Trim()).ToLower().CompareTo(("声望").ToLower()) == 0)
                        {
                            m_btCreditPoint += (int)ItemNum;
                            szString = GameMsgDef.g_sBoxsItemHintMsg.Replace("%name", this.m_sCharName);
                            szString = szString.Replace("%s", "声望  " + (ItemNum).ToString());
                            UserEngine.SendBroadCastMsgExt(szString, TMsgType.t_Say);// 向每个人物发送消息
                        }
                        else if ((ItemName.Trim()).ToLower().CompareTo((GameConfig.sGameDiaMond).ToLower()) == 0)
                        {
                            m_nGAMEDIAMOND += (int)ItemNum;
                            this.GameGoldChanged();// 更新金刚石数量
                            szString = GameMsgDef.g_sBoxsItemHintMsg.Replace("%name", this.m_sCharName);
                            szString = szString.Replace("%s", GameConfig.sGameDiaMond + "  " + (ItemNum).ToString());
                            UserEngine.SendBroadCastMsgExt(szString, TMsgType.t_Say);// 向每个人物发送消息
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject::ClientGetBoxsItme");
            }
        }

        // --------------------淬炼系统--------------
        // 客户端增加物品到淬炼框中
        public unsafe bool ClientAddRefineItem(string sItemIdx)
        {
            bool result;
            int I;
            TUserItem* UserItem;
            int nItemIdx;
            int nItemIdx1;
            int nItemIdx2;
            string Str = string.Empty;
            string Str1 = string.Empty;
            result = false;
            nItemIdx = 0;
            nItemIdx1 = 0;
            nItemIdx2 = 0;
            if (sItemIdx != "")
            {
                sItemIdx = HUtil32.GetValidStr3(sItemIdx, ref Str, new string[] { "/", "\09" });
                sItemIdx = HUtil32.GetValidStr3(sItemIdx, ref Str1, new string[] { "/", "\09" });
                nItemIdx = HUtil32.Str_ToInt(Str, 0);
                nItemIdx1 = HUtil32.Str_ToInt(Str1, 0);
                nItemIdx2 = HUtil32.Str_ToInt(sItemIdx, 0);
            }
            for (I = this.m_ItemList.Count - 1; I >= 0; I--)
            {
                if (this.m_ItemList.Count <= 0)
                {
                    break;
                }
                UserItem = (TUserItem*)this.m_ItemList[I];
                if (UserItem == null)
                {
                    continue;
                }
                if ((UserItem->MakeIndex == nItemIdx) || (UserItem->MakeIndex == nItemIdx1) || (UserItem->MakeIndex == nItemIdx2))
                {
                    if ((m_RefineItemList.Count < 4))
                    {
                        m_RefineItemList.Add((IntPtr)UserItem);
                        this.m_ItemList.RemoveAt(I);
                        if (m_RefineItemList.Count == 3)
                        {
                            result = true;
                            break;
                        }
                    }
                }
            }
            return result;
        }

        // 取淬练列表物品
        public unsafe void GetBackRefineItem()
        {
            TClientItem* ClientItem = null;
            TStdItem* StdItem = null;
            TStdItem* pStdItem = null;
            TUserItem* UserItem = null;
            string sSENDMSG;
            string sUserItemName;
            sSENDMSG = "";
            if (m_RefineItemList.Count > 0)
            {
                for (int I = 0; I < m_RefineItemList.Count; I++)
                {
                    UserItem = (TUserItem*)m_RefineItemList[I];
                    if (UserItem->MakeIndex > 0)
                    {
                        this.m_ItemList.Add((IntPtr)UserItem);
                        pStdItem = UserEngine.GetStdItem(UserItem->wIndex);
                        if (pStdItem != null)
                        {
                            StdItem = pStdItem;
                            if (StdItem->NeedIdentify == 1)
                            {
                                M2Share.AddGameDataLog("41" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString() + "\09" + (this.m_nCurrY).ToString()
                                    + "\09" + this.m_sCharName + "\09" + HUtil32.SBytePtrToString(StdItem->Name, 0, StdItem->NameLen) + "\09" + (UserItem->MakeIndex).ToString() + "\09" + "("
                                    + (HUtil32.LoWord(StdItem->DC)).ToString() + "/" + (HUtil32.HiWord(StdItem->DC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MC)).ToString()
                                    + "/" + (HUtil32.HiWord(StdItem->MC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->SC)).ToString() + "/" + (HUtil32.HiWord(StdItem->SC)).ToString() + ")"
                                    + "(" + (HUtil32.LoWord(StdItem->AC)).ToString() + "/" + (HUtil32.HiWord(StdItem->AC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MAC)).ToString() + "/"
                                    + (HUtil32.HiWord(StdItem->MAC)).ToString() + ")" + (UserItem->btValue[0]).ToString() + "/" + (UserItem->btValue[1]).ToString() + "/"
                                    + (UserItem->btValue[2]).ToString() + "/" + (UserItem->btValue[3]).ToString() + "/" + (UserItem->btValue[4]).ToString() + "/"
                                    + (UserItem->btValue[5]).ToString() + "/" + (UserItem->btValue[6]).ToString() + "/" + (UserItem->btValue[7]).ToString() + "/"
                                    + (UserItem->btValue[8]).ToString() + "/" + (UserItem->btValue[14]).ToString() + "\09" + (UserItem->Dura).ToString() + "/"
                                    + (UserItem->DuraMax).ToString());
                            }
                            ItemUnit.GetItemAddValue(UserItem, StdItem);
                            ClientItem->s = *StdItem;
                            //Move(StdItem, ClientItem->s, sizeof(TStdItem));
                            // 取自定义物品名称
                            sUserItemName = "";
                            if (UserItem->btValue[13] == 1)
                            {
                                sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                            }
                            if (UserItem->btValue[12] == 1)
                            {
                                // 物品发光
                                ClientItem->s.Reserved1 = 1;
                            }
                            else
                            {
                                ClientItem->s.Reserved1 = 0;
                            }
                            if (sUserItemName != "")
                            {
                                HUtil32.StrToSByteArry(sUserItemName, ClientItem->s.Name, 14, ref ClientItem->s.NameLen);
                                //ClientItem->s->Name = sUserItemName;
                            }
                            ClientItem->Dura = UserItem->Dura;
                            ClientItem->DuraMax = UserItem->DuraMax;
                            ClientItem->MakeIndex = UserItem->MakeIndex;
                            // sSENDMSG = sSENDMSG + EncryptUnit.EncodeBuffer(ClientItem, sizeof(TClientItem)) + "/";
                        }
                    }
                }
            }
            this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_UPDATERYREFINEITEM, HUtil32.ObjectToInt(this), 0, 0, 0, 0);

            SendSocket(this.m_DefMsg, sSENDMSG);

            m_RefineItemList.Clear();
        }

        // 取备份淬练列表物品
        // 取淬练列表物品的名称
        public unsafe void GetBackRefineItemName(ref string sItemName, ref string sItemName1, ref string sItemName2)
        {
            int I;
            TUserItem* UserItem;
            TStdItem* StdItem;
            string str;
            str = "";
            if (m_RefineItemList.Count > 0)
            {
                for (I = 0; I < m_RefineItemList.Count; I++)
                {
                    UserItem = (TUserItem*)m_RefineItemList[I];
                    StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                    if (str != "")
                    {
                        str = str + "+";
                    }
                    if (StdItem != null)
                    {
                        str = str + HUtil32.SBytePtrToString(StdItem->Name, 0, StdItem->NameLen);
                    }
                }
            }
            if (str != "")
            {
                str = HUtil32.GetValidStr3(str, ref sItemName, new string[] { "+" });
                str = HUtil32.GetValidStr3(str, ref sItemName1, new string[] { "+" });
                str = HUtil32.GetValidStr3(str, ref sItemName2, new string[] { "+" });
            }
        }

        // 淬练过程
        public unsafe void ClientRefineItem()
        {
            ArrayList RefineItemList;
            TRefineItemInfo RefineItemInfo = new TRefineItemInfo();
            int addValue = 0, T = 0;
            TUserItem* UserItem = null, UserItem1 = null, UserItem2 = null;
            TStdItem* StdItem = null, StdItem1 = null;
            string sItemName = string.Empty, sItemName1 = string.Empty, sItemName2 = string.Empty;
            string str = string.Empty;
            bool boOK = false;
            try
            {
                if ((M2Share.g_RefineItemList == null) || (M2Share.g_RefineItemList.Count == 0))
                {
                    return;
                }
                if ((m_RefineItemList == null) || (m_RefineItemList.Count == 0))
                {
                    return;
                }
                GetBackRefineItemName(ref sItemName, ref sItemName1, ref sItemName2);// 取出粹练框中的物品名称
                RefineItemList = M2Share.GetRefineItemInfo(sItemName, sItemName1, sItemName2);// 取出对应配方的物品配置列表
                if (RefineItemList != null)
                {
                    if (RefineItemList.Count > 1)// 当淬炼原料下列表有多个物品，将随机抽取
                    {
                        for (int I = 0; I < RefineItemList.Count; I++)
                        {
                            T = HUtil32.Random(RefineItemList.Count);
                            RefineItemInfo = ((TRefineItemInfo)(RefineItemList[T]));
                            //if (RefineItemInfo != null)
                            //{
                            //    break;
                            //}
                        }
                    }
                    else
                    {
                        RefineItemInfo = ((TRefineItemInfo)(RefineItemList[0])); // 不管成功以否,火云石都要掉持久或消失
                    }
                    if (RefineItemInfo.boDisappear)
                    {
                        // 掉持久
                        for (int I = m_RefineItemList.Count - 1; I >= 0; I--)
                        {
                            if (m_RefineItemList.Count <= 0)
                            {
                                break;
                            }
                            UserItem = (TUserItem*)m_RefineItemList[I];
                            StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                            if ((StdItem != null) && (StdItem->StdMode == 25) && ((StdItem->Shape == 10) || (StdItem->Shape == 11)))
                            {
                                if (UserItem->Dura >= 100)
                                {
                                    UserItem->Dura -= 100;// 掉持久
                                    if (UserItem->Dura <= 0)
                                    {
                                        m_RefineItemList.RemoveAt(I);
                                        Marshal.FreeHGlobal((IntPtr)UserItem);
                                    }
                                }
                                else
                                {
                                    m_RefineItemList.RemoveAt(I);
                                    Marshal.FreeHGlobal((IntPtr)UserItem);
                                }
                                break;
                            }
                        }
                    }
                    else
                    {
                        // 消失
                        for (int I = m_RefineItemList.Count - 1; I >= 0; I--)
                        {
                            if (m_RefineItemList.Count <= 0)
                            {
                                break;
                            }
                            UserItem = (TUserItem*)m_RefineItemList[I];
                            StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                            if ((StdItem != null) && (StdItem->StdMode == 25) && ((StdItem->Shape == 10) || (StdItem->Shape == 11)))
                            {
                                m_RefineItemList.RemoveAt(I);
                                Marshal.FreeHGlobal((IntPtr)UserItem);
                                boOK = true;
                                break;
                            }
                        }
                    }
                    if ((HUtil32.Random(100) <= RefineItemInfo.nRefineRate)) // 淬练成功率
                    {
                        UserItem1 = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                        if (UserEngine.CopyToUserItemFromName(RefineItemInfo.sItemName, UserItem1))
                        {
                            TAttribute* nAttribute = (TAttribute*)RefineItemInfo.TAttributeBuff;
                            for (int K = 0; K <= 13; K++)
                            {
                                if (nAttribute[K].nPoints == 0)
                                {
                                    continue;
                                }
                                // 最高限制升点数为零时,跳过
                                if (HUtil32.Random(nAttribute[K].nDifficult) == 0) // 淬炼难度
                                {
                                    addValue = nAttribute[K].nPoints - UserItem1->btValue[K];
                                    UserItem1->btValue[K] = (byte)nAttribute[K].nPoints;
                                }
                                else
                                {
                                    addValue = UserItem1->btValue[K];
                                    UserItem1->btValue[K] = Convert.ToByte(UserItem1->btValue[K] + HUtil32.Random(nAttribute[K].nPoints - 1) + 1);// 随机加点数 加1,防止随机值为0
                                    UserItem1->btValue[K] = Convert.ToByte(HUtil32._MIN(nAttribute[K].nPoints - 1, UserItem1->btValue[K]));
                                    addValue = UserItem1->btValue[K] - addValue;
                                }
                                if (addValue > 0)
                                {
                                    StdItem1 = UserEngine.GetStdItem(UserItem1->wIndex);
                                    if (str != "")
                                    {
                                        str = str + " ";
                                    }
                                    switch (StdItem1->StdMode)
                                    {
                                        case 19:
                                            switch (K)
                                            {
                                                case 0:
                                                    str = str + " 魔法躲避增加" + addValue + "点";
                                                    break;
                                                case 1:
                                                    str = str + " 幸运增加" + addValue + "点";
                                                    break;
                                                case 2:
                                                    str = str + " 攻击增加" + addValue + "点";
                                                    break;
                                                case 3:
                                                    str = str + " 魔法增加" + addValue + "点";
                                                    break;
                                                case 4:
                                                    str = str + " 道术增加" + addValue + "点";
                                                    break;
                                                case 14:
                                                    str = str + " 持久增加" + addValue + "点";
                                                    break;
                                            }
                                            break;
                                        case 20:
                                        case 24:
                                            switch (K)
                                            {
                                                case 0:
                                                    str = str + " 准确增加" + addValue + "点";
                                                    break;
                                                case 1:
                                                    str = str + " 敏捷增加" + addValue + "点";
                                                    break;
                                                case 2:
                                                    str = str + " 攻击增加" + addValue + "点";
                                                    break;
                                                case 3:
                                                    str = str + " 魔法增加" + addValue + "点";
                                                    break;
                                                case 4:
                                                    str = str + " 道术增加" + addValue + "点";
                                                    break;
                                                case 14:
                                                    str = str + " 持久增加" + addValue + "点";
                                                    break;
                                            }
                                            break;
                                        case 21:
                                            switch (K)
                                            {
                                                case 0:
                                                    str = str + " 体力恢复增加" + addValue + "点";
                                                    break;
                                                case 1:
                                                    str = str + " 魔法恢复增加" + addValue + "点";
                                                    break;
                                                case 2:
                                                    str = str + " 攻击增加" + addValue + "点";
                                                    break;
                                                case 3:
                                                    str = str + " 魔法增加" + addValue + "点";
                                                    break;
                                                case 4:
                                                    str = str + " 道术增加" + addValue + "点";
                                                    break;
                                                case 14:
                                                    str = str + " 持久增加" + addValue + "点";
                                                    break;
                                            }
                                            break;
                                        case 23:
                                            switch (K)
                                            {
                                                case 0:
                                                    str = str + " 毒物躲避增加" + addValue + "点";
                                                    break;
                                                case 1:
                                                    str = str + " 中毒恢复增加" + addValue + "点";
                                                    break;
                                                case 2:
                                                    str = str + " 攻击增加" + addValue + "点";
                                                    break;
                                                case 3:
                                                    str = str + " 魔法增加" + addValue + "点";
                                                    break;
                                                case 4:
                                                    str = str + " 道术增加" + addValue + "点";
                                                    break;
                                                case 14:
                                                    str = str + " 持久增加" + addValue + "点";
                                                    break;
                                            }
                                            break;
                                        case 5:
                                        case 6:
                                            switch (K)
                                            {
                                                case 0:
                                                    str = str + " 攻击增加" + addValue + "点";
                                                    break;
                                                case 1:
                                                    str = str + " 魔法增加" + addValue + "点";
                                                    break;
                                                case 2:
                                                    str = str + " 道术增加" + addValue + "点";
                                                    break;
                                                case 3:
                                                    str = str + " 幸运增加" + addValue + "点";
                                                    break;
                                                case 4:
                                                    str = str + " 诅咒增加" + addValue + "点";
                                                    break;
                                                case 5:
                                                    str = str + " 准确增加" + addValue + "点";
                                                    break;
                                                case 6:
                                                    str = str + " 攻击速度增加" + addValue + "点";
                                                    break;
                                                case 7:
                                                    str = str + " 强度增加" + addValue + "点";
                                                    break;
                                                case 14:
                                                    str = str + " 持久增加" + addValue + "点";
                                                    break;
                                            }
                                            break;
                                        default:
                                            switch (K)
                                            {
                                                case 0:
                                                    str = str + " 防御增加" + addValue + "点";
                                                    break;
                                                case 1:
                                                    str = str + " 魔御增加" + addValue + "点";
                                                    break;
                                                case 2:
                                                    str = str + " 攻击增加" + addValue + "点";
                                                    break;
                                                case 3:
                                                    str = str + " 魔法增加" + addValue + "点";
                                                    break;
                                                case 4:
                                                    str = str + " 道术增加" + addValue + "点";
                                                    break;
                                                case 14:
                                                    str = str + " 持久增加" + addValue + "点";
                                                    break;
                                            }
                                            break;
                                    }
                                }
                            }
                            if ((HUtil32.Random(100) <= RefineItemInfo.nNeedRate))
                            {
                                UserEngine.RandomUpgradeItem(UserItem1);
                            }
                            // 极品属性几率,附加极品属性
                            if (!boOK)
                            {
                                for (int I = m_RefineItemList.Count - 1; I >= 0; I--)
                                {
                                    // 在成功率内,则删除除火云石外的物品
                                    if (m_RefineItemList.Count <= 0)
                                    {
                                        break;
                                    }
                                    UserItem2 = (TUserItem*)m_RefineItemList[I];
                                    if ((UserItem2 != null) && (UserItem2->MakeIndex > 0))
                                    {
                                        StdItem1 = UserEngine.GetStdItem(UserItem2->wIndex);
                                        if ((StdItem1 != null) && (StdItem1->StdMode != 25) && (HUtil32.SBytePtrToString(StdItem1->Name, 0, StdItem1->NameLen) != ""))
                                        {
                                            m_RefineItemList.RemoveAt(I);
                                            UserItem2 = null;
                                        }
                                    }
                                }
                            }
                            else
                            {
                                m_RefineItemList.Clear();
                            }
                            m_RefineItemList.Add((IntPtr)UserItem1);// 物品保存到列表中
                            this.SysMsg(string.Format(GameMsgDef.sRefineItemSuccessMsg + str, RefineItemInfo.sItemName), TMsgColor.c_Green, TMsgType.t_Hint);// 成功提示
                        }
                    }
                    else
                    {
                        if ((HUtil32.Random(100) <= RefineItemInfo.nReductionRate)) // 失败后,在还原成功率内,则删除弩牌或封印装备
                        {
                            for (int I = m_RefineItemList.Count - 1; I >= 0; I--)// 修改
                            {

                                if (m_RefineItemList.Count <= 0)
                                {
                                    break;
                                }
                                UserItem = (TUserItem*)m_RefineItemList[I];
                                StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                                if ((StdItem != null) && ((StdItem->StdMode == 47) || ("封印".IndexOf(HUtil32.SBytePtrToString(StdItem->Name, 0, StdItem->NameLen)) > 0)))
                                {
                                    m_RefineItemList.RemoveAt(I);
                                    Marshal.FreeHGlobal((IntPtr)UserItem);
                                }
                            }
                        }
                        else
                        {
                            // 失败后,不在还原成功率内,1-合成新物品,则删除物品,除火去石外  2-升级物品,则初始属性
                            if (((RefineItemInfo.sItemName).ToLower().CompareTo((sItemName).ToLower()) == 0) || ((RefineItemInfo.sItemName).ToLower().CompareTo((sItemName1).ToLower()) == 0) || ((RefineItemInfo.sItemName).ToLower().CompareTo((sItemName2).ToLower()) == 0))
                            {
                                for (int I = m_RefineItemList.Count - 1; I >= 0; I--)
                                {
                                    if (m_RefineItemList.Count <= 0)
                                    {
                                        break;
                                    }
                                    UserItem = (TUserItem*)m_RefineItemList[I];
                                    StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                                    if ((StdItem != null))
                                    {
                                        if (((HUtil32.SBytePtrToString(StdItem->Name, 0, StdItem->NameLen)).ToLower().CompareTo((RefineItemInfo.sItemName).ToLower()) == 0))
                                        {
                                            //m_RefineItemList.Delete(I);
                                            for (int K = 0; K <= 13; K++)
                                            {
                                                UserItem->btValue[K] = 0; // 初始属性
                                            }
                                            m_RefineItemList.Add((IntPtr)UserItem);
                                        }
                                        else if ((StdItem->StdMode != 25))
                                        {
                                            m_RefineItemList.RemoveAt(I);
                                            UserItem = null;
                                            Marshal.FreeHGlobal((IntPtr)UserItem);
                                        }
                                    }
                                }
                            }
                            else
                            {
                                for (int I = m_RefineItemList.Count - 1; I >= 0; I--)
                                {
                                    if (m_RefineItemList.Count <= 0)
                                    {
                                        break;
                                    }
                                    UserItem = (TUserItem*)m_RefineItemList[I];
                                    StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                                    if ((StdItem != null) && (StdItem->StdMode != 25))
                                    {
                                        m_RefineItemList.RemoveAt(I);
                                        UserItem = null;
                                    }
                                }
                            }
                        }
                        // '粹练装备失败!'
                        this.SysMsg(GameMsgDef.sRefineItemFailMsg, TMsgColor.c_Red, TMsgType.t_Hint);// 失败提示
                    }
                    GetBackRefineItem();// 发消息,更新粹练框中的物品
                }
                else
                {
                    if (m_RefineItemList.Count > 0)
                    {
                        for (int I = 0; I < m_RefineItemList.Count; I++)
                        {
                            UserItem = (TUserItem*)m_RefineItemList[I];
                            if (UserItem->MakeIndex > 0)
                            {
                                this.m_ItemList.Add((IntPtr)UserItem);
                            }
                        }
                    }
                    // '这次无法控制火云石的力量，淬炼失败了'
                    this.SysMsg(GameMsgDef.sRefineItemErrorMsg, TMsgColor.c_Red, TMsgType.t_Hint);// 物品不是配方里的物品,失败提示
                    m_RefineItemList.Clear();
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.ClientRefineItem");
            }
        }

        // 淬炼
        // ------------------------------------------------------------------------------
        public unsafe bool WearRefineItem()
        {
            bool result = false;
            TStdItem* StdItem;
            if (this.m_UseItems[TPosition.U_BUJUK]->wIndex > 0)
            {
                StdItem = UserEngine.GetStdItem(this.m_UseItems[TPosition.U_BUJUK]->wIndex);
                if ((StdItem != null) && (StdItem->StdMode == 25) && (StdItem->Shape == 10))
                {
                    result = true;
                }
            }
            return result;
        }

        // 修补火云石
        public unsafe void RepairRefineItem(int nItemIdx, string sItemName)
        {
            int I;
            int n14;
            TUserItem* UserItem = null;
            TStdItem* StdItem;
            string sUserItemName;
            bool boRepairOK;
            int OldDura;
            boRepairOK = false;
            StdItem = null;
            OldDura = 0;
            n14 = -1;
            if (WearRefineItem())
            {
                if ((this.m_UseItems[TPosition.U_BUJUK]->Dura < this.m_UseItems[TPosition.U_BUJUK]->DuraMax) && (this.m_UseItems[TPosition.U_BUJUK]->Dura >= 500))
                {
                    OldDura = this.m_UseItems[TPosition.U_BUJUK]->Dura;
                    if (this.m_ItemList.Count > 0)
                    {
                        for (I = 0; I < this.m_ItemList.Count; I++)
                        {
                            UserItem = (TUserItem*)this.m_ItemList[I];
                            if ((UserItem != null) && (UserItem->MakeIndex == nItemIdx))
                            {
                                // 取自定义物品名称
                                sUserItemName = "";
                                if (UserItem->btValue[13] == 1)
                                {
                                    sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                                }
                                if (sUserItemName == "")
                                {
                                    sUserItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                                }
                                StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                                if (StdItem != null)
                                {
                                    if ((sUserItemName).ToLower().CompareTo((sItemName).ToLower()) == 0)
                                    {
                                        n14 = I;
                                        break;
                                    }
                                }
                            }
                        }
                        if ((StdItem != null) && (UserItem != null) && (StdItem->StdMode == 43) && (StdItem->Shape == 1))
                        {
                            this.m_UseItems[TPosition.U_BUJUK]->Dura += 500;
                            if (this.m_UseItems[TPosition.U_BUJUK]->Dura > this.m_UseItems[TPosition.U_BUJUK]->DuraMax)
                            {
                                this.m_UseItems[TPosition.U_BUJUK]->Dura = this.m_UseItems[TPosition.U_BUJUK]->DuraMax;
                            }
                            boRepairOK = true;
                            this.DelBagItem(n14);
                        }
                    }
                }
            }
            if (boRepairOK)
            {
                if (OldDura != this.m_UseItems[TPosition.U_BUJUK]->Dura)
                {
                    this.SendMsg(this, Grobal2.RM_DURACHANGE, TPosition.U_BUJUK, this.m_UseItems[TPosition.U_BUJUK]->Dura, this.m_UseItems[TPosition.U_BUJUK]->DuraMax, 0, "");
                }
                SendDefMessage(Grobal2.SM_REPAIRFINEITEM_OK, 0, 0, 0, 0, "");
            }
            else
            {
                SendDefMessage(Grobal2.SM_REPAIRFINEITEM_FAIL, 0, 0, 0, 0, "");
                this.SysMsg("修补火云石失败!", TMsgColor.BB_Fuchsia, TMsgType.t_Hint);
            }
        }

        // 取回英雄
        public void ClientGETHERO(string sHeroName, byte nHeroTpye)
        {
            if (sHeroName != "")
            {
                m_sHeroCharName = sHeroName;
                n_myHeroTpye = nHeroTpye;
                switch (n_myHeroTpye)// 英雄的类型
                {
                    case 0:
                        m_boHasHero = true;
                        break;
                    case 1:
                        m_boHasHeroTwo = true;
                        break;
                }
                if (M2Share.g_FunctionNPC != null)
                {
                    M2Share.g_FunctionNPC.GotoLable(this, "@GetHeroOk", false);
                }
            }
            else
            {
                if (M2Share.g_FunctionNPC != null)
                {
                    M2Share.g_FunctionNPC.GotoLable(this, "@GetHeroBak", false);
                }
            }
        }

        // 请酒
        public unsafe void ClientPlayDrinkItem(int NPC, int nItemIdx, string sMsg)
        {
            TMerchant Merchant;
            int I;
            TUserItem* UserItem;
            bool bo19;
            TStdItem* StdItem;
            string sUserItemName;
            bo19 = false;
            Merchant = UserEngine.FindMerchant(NPC);
            if ((Merchant != null) && (Merchant.m_boPlayDrink))
            {
                // 请酒斗酒NPC
                // 折分物品名称(信件物品的名称后面加了使用次数)
                if (sMsg.IndexOf(" ") >= 0)
                {
                    HUtil32.GetValidStr3(sMsg, ref sMsg, new string[] { " " });
                }
                for (I = this.m_ItemList.Count - 1; I >= 0; I--)
                {
                    if (this.m_ItemList.Count <= 0)
                    {
                        break;
                    }
                    UserItem = (TUserItem*)(TUserItem*)this.m_ItemList[I];
                    if (UserItem->MakeIndex == nItemIdx)
                    {
                        // 取自定义物品名称
                        sUserItemName = "";
                        if (UserItem->btValue[13] == 1)
                        {
                            sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                        }
                        if (sUserItemName == "")
                        {
                            sUserItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                        }
                        if ((sUserItemName).ToLower().CompareTo((sMsg).ToLower()) == 0)
                        {
                            StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                            if ((StdItem->StdMode == 60) && (StdItem->Shape == 0)) // 是烧酒
                            {
                                this.m_ItemList.RemoveAt(I);// 删除物品
                                bo19 = true;
                            }
                        }
                        break;
                    }
                }
            }
            if (bo19)
            {
                SendDefMessage(Grobal2.SM_USERPLAYDRINK_OK, 0, 0, 0, 0, "");
                if (Merchant != null)
                {
                    Merchant.GotoLable(this, "~PlayDrink_Game", false);
                }
            }
            else
            {
                SendDefMessage(Grobal2.SM_USERPLAYDRINK_FAIL, 0, 0, 0, 0, "");
            }
        }

        // 请酒信息跳转
        public void ClientPlayDrinkLable(int nParam1, string sMsg)
        {
            TNormNpc NPC;
            string sLabel = string.Empty;
            if (this.m_boDeath || this.m_boGhost)
            {
                return;
            }
            NPC = UserEngine.FindMerchant(nParam1);
            if (NPC == null)
            {
                NPC = UserEngine.FindNPC(nParam1);
            }
            if (NPC == null)
            {
                return;
            }
            if ((sMsg != "") && (sMsg[0] == '@'))
            {
                HUtil32.GetValidStr3(sMsg, ref sLabel, new string[] { "\r" });
                NPC.GotoLable(this, sLabel, false);
            }
        }

        /// <summary>
        /// 请酒信息跳转
        /// 比较NPC与玩家出码数,并判断输赢
        /// 码值:0-石 1-剪刀 2-布  nCode 0-赢  1-输  2-平
        /// </summary>
        /// <param name="nParam1"></param>
        /// <param name="nPlayNum"></param>
        public void ClientPlayDrinkToDrink(int nParam1, byte nPlayNum)
        {
            int nNpcNum;
            byte nCode;
            TNormNpc NPC;
            nCode = 3;// 猜码结果
            nNpcNum = HUtil32.Random(3);
            switch (nPlayNum)// 随机取NPC出码值
            {
                case 0:
                    switch (nNpcNum)
                    {
                        case 0: // 平
                            nCode = 2;
                            break;
                        case 1: // 输
                            nCode = 0;
                            break;
                        case 2: // 赢
                            nCode = 1;
                            break;
                    }
                    break;
                case 1:
                    switch (nNpcNum)
                    {
                        case 0:// 输
                            nCode = 1;
                            break;
                        case 1: // 平
                            nCode = 2;
                            break;
                        case 2:// 赢
                            nCode = 0;
                            break;
                    }
                    break;
                case 2:
                    switch (nNpcNum)
                    {
                        case 0: // 赢
                            nCode = 0;
                            break;
                        case 1: // 输
                            nCode = 1;
                            break;
                        case 2: // 平
                            nCode = 2;
                            break;
                    }
                    break;
            }
            if ((nCode < 3)) // 有了结果,发消息给客户端
            {
                NPC = UserEngine.FindMerchant(nParam1);
                if (NPC == null)
                {
                    NPC = UserEngine.FindNPC(nParam1);
                }
                switch (nCode)
                {
                    case 0:// 玩家赢
                        NPC.GotoLable(this, "~PlayDrink_PlayWil", false);
                        break;
                    case 1: // NPC赢
                        NPC.GotoLable(this, "~PlayDrink_NpcWil", false);
                        break;
                }
                this.SendMsg(this, Grobal2.RM_PlayDrinkToDrink, 0, nPlayNum, nNpcNum, nCode, "");
            }
        }

        /// <summary>
        /// 比较NPC与玩家出码数,并判断输赢
        /// 喝酒并增加醉酒值
        /// 参数:nPlayNum--谁喝酒(0-玩家喝 1-NPC喝) nCode--谁赢(0-NPC 1-玩家)
        /// 如果NPC胜,则随机选择谁喝酒,玩家胜,则以玩家的选择来决定
        /// </summary>
        /// <param name="nParam1"></param>
        /// <param name="nPlayNum">谁喝酒(0-玩家喝 1-NPC喝)</param>
        /// <param name="nCode">谁赢(0-NPC 1-玩家)</param>
        public void ClientDrinkUpdateValue(int nParam1, byte nPlayNum, byte nCode)
        {
            TNormNpc NPC;
            bool boDrinkLoss;
            if (n_DrinkCount < 7)
            {
                boDrinkLoss = true;
                NPC = UserEngine.FindMerchant(nParam1);
                if (NPC == null)
                {
                    NPC = UserEngine.FindNPC(nParam1);
                }
                n_DrinkCount++;// 累积喝酒次数,即喝了几瓶酒
                switch (nCode)
                {
                    case 0:
                        switch (HUtil32.Random(2))// NPC胜
                        {
                            case 0:// 玩家喝
                                n_DrinkValue[1] = Convert.ToByte(n_DrinkValue[1] + HUtil32.Random(25) + 8);
                                if (n_DrinkValue[1] > 100)
                                {
                                    n_DrinkValue[1] = 100;
                                }
                                nPlayNum = 0;
                                NPC.GotoLable(this, "~PlayDrink_NpcToSelf", false);
                                break;
                            case 1:// NPC喝
                                n_DrinkValue[0] = Convert.ToByte(n_DrinkValue[0] + HUtil32.Random(25) + 8);
                                if (n_DrinkValue[0] > 100)
                                {
                                    n_DrinkValue[0] = 100;
                                }
                                nPlayNum = 1;
                                NPC.GotoLable(this, "~PlayDrink_NpcToNpc", false);
                                break;
                        }
                        break;
                    case 1:
                        switch (nPlayNum)// 玩家胜
                        {
                            case 0:// 玩家喝
                                n_DrinkValue[1] = Convert.ToByte(n_DrinkValue[1] + HUtil32.Random(30) + 10);
                                if (n_DrinkValue[1] > 100)
                                {
                                    n_DrinkValue[1] = 100;
                                }
                                NPC.GotoLable(this, "~PlayDrink_SelfToSelf", false);
                                break;
                            case 1:// NPC喝
                                n_DrinkValue[0] = Convert.ToByte(n_DrinkValue[0] + HUtil32.Random(30) + 10);
                                if (n_DrinkValue[0] > 100)
                                {
                                    n_DrinkValue[0] = 100;
                                }
                                NPC.GotoLable(this, "~PlayDrink_SelfToNpc", false);
                                break;
                        }
                        break;
                }
                // case nCode of
                if (n_DrinkValue[0] >= 92)
                {
                    // NPC喝醉,斗酒失败
                    NPC.GotoLable(this, "~PlayDrink_Npc_Drunk", false);
                    boDrinkLoss = false;
                }
                else if (n_DrinkValue[1] >= 92)
                {
                    // 玩家喝醉
                    NPC.GotoLable(this, "~PlayDrink_Self_Drunk", false);
                    boDrinkLoss = false;
                }
                else if (n_DrinkCount == 6)
                {
                    // 喝完酒,判断结果
                    if (n_DrinkValue[0] > n_DrinkValue[1])
                    {
                        // 玩家斗酒胜
                        NPC.GotoLable(this, "~PlayDrink_Npc_Loss", false);
                    }
                    else
                    {
                        NPC.GotoLable(this, "~PlayDrink_Self_Loss", false);
                    }
                    boDrinkLoss = false;
                }
                if (boDrinkLoss)
                {
                    // 参数0-可以继续喝 1-斗酒结束
                    this.SendMsg(this, Grobal2.RM_DrinkUpdateValue, 0, nPlayNum, n_DrinkValue[0], n_DrinkValue[1], "");
                }
                else
                {
                    this.SendMsg(this, Grobal2.RM_DrinkUpdateValue, 1, nPlayNum, n_DrinkValue[0], n_DrinkValue[1], "");
                }
            }
        }

        // 喝酒并增加醉酒值 
        // 请酒
        // 判断放上的两物品是不是烧酒,如果是则删除物品,触发脚本段
        public unsafe void ClientPlayDrink(string sMsg)
        {
            TMerchant Merchant;
            int I;
            TUserItem* UserItem;
            bool bo19;
            bool bo20;
            TStdItem* StdItem;
            int nItemIdx;
            int nItemIdx1;
            int NPCID;
            string Str = string.Empty;
            string Str1 = string.Empty;
            NPCID = 0;
            nItemIdx = 0;
            nItemIdx1 = 0;
            bo19 = false;
            bo20 = false;
            if (sMsg != "")
            {
                sMsg = HUtil32.GetValidStr3(sMsg, ref Str, new string[] { "/", "\09" });
                sMsg = HUtil32.GetValidStr3(sMsg, ref Str1, new string[] { "/", "\09" });
                NPCID = HUtil32.Str_ToInt(Str, 0);
                nItemIdx = HUtil32.Str_ToInt(Str1, 0);
                nItemIdx1 = HUtil32.Str_ToInt(sMsg, 0);
            }
            if ((NPCID != 0) && (nItemIdx != 0) && (nItemIdx1 != 0))
            {
                Merchant = UserEngine.FindMerchant(NPCID);
                if ((Merchant != null) && (Merchant.m_boPlayDrink)) // 请酒NPC
                {
                    for (I = this.m_ItemList.Count - 1; I >= 0; I--)
                    {
                        if (this.m_ItemList.Count <= 0)
                        {
                            break;
                        }
                        UserItem = (TUserItem*)this.m_ItemList[I];
                        if (UserItem->MakeIndex == nItemIdx)
                        {
                            StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                            if ((StdItem->StdMode == 60) && (StdItem->Shape == 0))
                            {
                                bo19 = true; // 是烧酒
                            }
                        }
                        else if (UserItem->MakeIndex == nItemIdx1)
                        {
                            StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                            if ((StdItem->StdMode == 60) && (StdItem->Shape == 0))
                            {
                                bo20 = true;// 是烧酒
                            }
                        }
                        if (bo19 && bo20)
                        {
                            break;
                        }
                    }
                }
                if (bo19 && bo20)
                {
                    for (I = this.m_ItemList.Count - 1; I >= 0; I--) // 删除物品
                    {
                        if (this.m_ItemList.Count <= 0)
                        {
                            break;
                        }
                        UserItem = (TUserItem*)this.m_ItemList[I];
                        if ((UserItem->MakeIndex == nItemIdx) || (UserItem->MakeIndex == nItemIdx1))
                        {
                            this.m_ItemList.RemoveAt(I);
                        }
                    }
                    SendDefMessage(Grobal2.SM_USERPLAYDRINKITEM_OK, 0, 0, 0, 0, "");
                    m_boPlayDrink = true;// 是否请过酒 T-请过酒
                    if (Merchant != null)
                    {
                        Merchant.GotoLable(this, "~PlayDrink_Ok", false);
                    }
                }
                else
                {
                    SendDefMessage(Grobal2.SM_USERPLAYDRINKITEM_FAIL, 0, 0, 0, 0, "");
                }
            }
        }

        /// <summary>
        /// 读取师徒文件
        /// </summary>
        /// <returns></returns>
        public bool GetMasterNoList()
        {
            bool result;
            int I;
            TStringList LoadList;
            string sFileName;
            string s01 = string.Empty;
            string s02 = string.Empty;
            string s03 = string.Empty;
            TMasterList TMasterList;
            result = false;
            try
            {
                sFileName = GameConfig.sEnvirDir + "MasterNo";
                if (!Directory.Exists(sFileName))// 目录不存在,则创建
                {
                    Directory.CreateDirectory(sFileName);
                }
                if (m_sMasterName != "") // 有师傅,取排名
                {
                    sFileName = sFileName + "\\" + m_sMasterName + ".txt";
                    LoadList = new TStringList();
                    if (File.Exists(sFileName))
                    {
                        LoadList.LoadFromFile(sFileName);
                        if (LoadList.Count > 0)
                        {
                            for (I = 0; I < LoadList.Count; I++)
                            {
                                s01 = LoadList[I].Trim();
                                if ((s01 != "") && (s01[1] != ';'))
                                {
                                    s01 = HUtil32.GetValidStr3(s01, ref s02, new string[] { " ", "\09" });// 徒弟名
                                    s01 = HUtil32.GetValidStr3(s01, ref s03, new string[] { " ", "\09" });// 排行
                                    if (s02 != "")
                                    {
                                        if ((this.m_sCharName).ToLower().CompareTo((s02).ToLower()) == 0)
                                        {
                                            // m_nMasterNo = HUtil32.Str_ToInt(s03, 0);
                                            result = true;
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    Dispose(LoadList);
                }
                else if (m_boMaster) // 有徒弟,取列表内容
                {
                    sFileName = sFileName + "\\" + this.m_sCharName + ".txt";
                    LoadList = new TStringList();
                    if (File.Exists(sFileName))
                    {
                        LoadList.LoadFromFile(sFileName);
                        if (LoadList.Count > 0)
                        {
                            for (I = 0; I < LoadList.Count; I++)
                            {
                                s01 = LoadList[I].Trim();
                                if ((s01 != "") && (s01[0] != ';'))
                                {
                                    s01 = HUtil32.GetValidStr3(s01, ref s02, new string[] { " ", "\09" });// 徒弟名
                                    s01 = HUtil32.GetValidStr3(s01, ref s03, new string[] { " ", "\09" });// 排行
                                    if (s02 != "")
                                    {
                                        TMasterList = new TMasterList();
                                        TMasterList.ID = Convert.ToInt32(s03);
                                        TMasterList.sChrName = s02;
                                        // m_MasterNoList.Add(s03, ((TMasterList) as Object));
                                    }
                                }
                            }
                        }
                        result = true;
                    }
                    Dispose(LoadList);
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.GetMasterNoList");
            }
            return result;
        }

        // 保存师徒文件
        public void SaveMasterNoList()
        {
            int I;
            TStringList SaveList;
            string sFileName;
            TMasterList TMasterList = null;
            try
            {
                sFileName = GameConfig.sEnvirDir + "MasterNo";
                if (!Directory.Exists(sFileName))
                {
                    Directory.CreateDirectory(sFileName);
                }
                // 目录不存在,则创建
                if (m_boMaster)
                {
                    // 有徒弟才能保存列表
                    sFileName = sFileName + "\\" + this.m_sCharName + ".txt";
                    SaveList = new TStringList();
                    MasterNoListQuickSort(m_MasterNoList, true);// 排序
                    if (m_MasterNoList.Count > 0)
                    {
                        for (I = 0; I < m_MasterNoList.Count; I++)
                        {
                            //TMasterList = ((TMasterList)(m_MasterNoList[I]));
                            //SaveList.Add(TMasterList.sChrName + " " + (TMasterList.ID).ToString());
                        }
                    }
                    SaveList.SaveToFile(sFileName);
                    SaveList.Dispose();
                    Dispose(SaveList);
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.SaveMasterNoList");
            }
        }

        // 收徒
        public void AddMaster(string MasterName)
        {
            TMasterList TMasterList;
            TMasterList = new TMasterList();
            TMasterList.sChrName = MasterName;
            TMasterList.ID = m_MasterNoList.Count + 1;
            //m_MasterNoList.Add((TMasterList.ID).ToString(), ((TMasterList) as Object));
            SaveMasterNoList();
            // 保存师徒文件 20080530
        }

        // 出师
        public void DelMaster(string MasterName)
        {
            int I;
            TMasterList TMasterList = null;
            for (I = m_MasterNoList.Count - 1; I >= 0; I--)
            {
                if (m_MasterNoList.Count <= 0)
                {
                    break;
                }
                // TMasterList = ((TMasterList)(m_MasterNoList[I]));
                if ((TMasterList.sChrName.Trim()).ToLower().CompareTo((MasterName.Trim()).ToLower()) == 0)
                {
                    Dispose(TMasterList);
                    m_MasterNoList.RemoveAt(I);
                    break;
                }
            }
            SaveMasterNoList();// 保存师徒文件
        }

        public void MasterNoListQuickSort_QuickSortStrListCase(List<string> List, int l, int r, bool Order)
        {
            int I;
            int j;
            string p;
            if (List.Count <= 0)
            {
                return;
            }
            do
            {
                I = l;
                j = r;
                p = List[(l + r) >> 1];
                do
                {
                    if (Order)
                    {
                        // 升序
                        while (List[I].CompareTo(p) < 0)
                        {
                            I++;
                        }
                        while (List[j].CompareTo(p) > 0)
                        {
                            j -= 1;
                        }
                    }
                    else
                    {
                        // 降序
                        while (p.CompareTo(List[I]) < 0)
                        {
                            I++;
                        }
                        while (p.CompareTo(List[j]) > 0)
                        {
                            j -= 1;
                        }
                    }
                    if (I <= j)
                    {
                        // List.Exchange(I, j);
                        I++;
                        j -= 1;
                    }
                } while (!(I > j));
                if (l < j)
                {
                    MasterNoListQuickSort_QuickSortStrListCase(List, l, j, Order);
                }
                l = I;
            } while (!(I >= r));
        }

        public void MasterNoListQuickSort_AddList(List<string> TempList, string slen, string s, Object AObject)
        {
            //int I;
            //List<string> List;
            //bool boFound;
            //boFound = false;
            //if (TempList.Count > 0)
            //{
            //    for (I = 0; I < TempList.Count; I++)
            //    {
            //        if ((TempList[I]).ToLower().CompareTo((slen).ToLower()) == 0)
            //        {
            //            List = ((TempList.Values[I]) as List<string>);
            //            List.Add(s, AObject);
            //            boFound = true;
            //            break;
            //        }
            //    }
            //}
            //if (!boFound)
            //{
            //    List = new List<string>();
            //    List.Add(s, AObject);
            //    TempList.Add(slen, List);
            //}
        }

        // 师徒数据排序  (用于徒弟出师,收徒后进行排名的排序)
        public void MasterNoListQuickSort(List<string> sList, bool Order)
        {
            List<string> TempList;
            List<string> List = null;
            int I;
            int nLen;
            TMasterList TMasterList;
            TempList = new List<string>();
            if (sList.Count > 0)
            {
                for (I = 0; I < sList.Count; I++)
                {
                    nLen = sList[I].Length;
                    // sList.Strings[I]
                    MasterNoListQuickSort_AddList(TempList, (nLen).ToString(), (I + 1).ToString(), sList[I]);
                }
            }
            MasterNoListQuickSort_QuickSortStrListCase(TempList, 0, TempList.Count - 1, Order);
            sList.Clear();
            if (TempList.Count > 0)
            {
                for (I = 0; I < TempList.Count; I++)
                {
                    //List = ((TempList[I]) as List<string>);
                    MasterNoListQuickSort_QuickSortStrListCase(List, 0, List.Count - 1, Order);
                    //sList.Add(List);
                    Dispose(List);
                }
            }
            Dispose(TempList);
            if (m_MasterNoList.Count > 0)
            {
                for (I = 0; I < m_MasterNoList.Count; I++)
                {
                    //TMasterList = ((TMasterList)(m_MasterNoList[I]));
                    //TMasterList.ID = I + 1;
                }
            }
        }

        public int ClientPlayMakeWine_GetRandomRange(int nCount, int nRate)
        {
            int result;
            int I;
            result = 0;
            if (nCount <= 0)
            {
                return result;
            }
            for (I = 0; I < nCount; I++)
            {
                if (HUtil32.Random(nRate) == 0)
                {
                    result++;
                }
            }
            return result;
        }

        // --------------------------酿酒系统-------------------------------------------
        /// <summary>
        /// 客户端开始酿酒
        /// </summary>
        /// <param name="nCode">0-普通 1-药酒</param>
        /// <param name="sMsg">NPC标识</param>
        public unsafe void ClientPlayMakeWine(byte nCode, string sMsg)
        {
            int nItemId;
            int nItemId1;
            int nItemId2;
            int nItemId3;
            int nItemId4;
            int nItemId5;
            int nItemId6;
            string Str = string.Empty;
            string Str1 = string.Empty;
            string Str2 = string.Empty;
            string Str3 = string.Empty;
            string Str4 = string.Empty;
            string Str5 = string.Empty;
            string Str6 = string.Empty;
            TStdItem* StdItem = null;
            TStdItem* StdItem1 = null;
            TStdItem* StdItem2 = null;
            TStdItem* StdItem3 = null;
            TStdItem* StdItem4 = null;
            TStdItem* StdItem5 = null;
            TStdItem* StdItem6 = null;
            TUserItem* UserItem;
            int I;
            int nC;
            bool boMakeWine;
            bool boMakeWineOK;
            byte Check;
            boMakeWine = false;
            boMakeWineOK = false;
            Check = 0;
            try
            {
                if ((new ArrayList(new int[] { 0, 1 }).Contains(nCode)) && (sMsg != "") && !m_boMakeWine)
                {
                    switch (nCode)
                    {
                        case 0:// 普通酒
                            sMsg = HUtil32.GetValidStr3(sMsg, ref Str, new string[] { "/", "\09" });
                            sMsg = HUtil32.GetValidStr3(sMsg, ref Str1, new string[] { "/", "\09" });
                            sMsg = HUtil32.GetValidStr3(sMsg, ref Str2, new string[] { "/", "\09" });
                            sMsg = HUtil32.GetValidStr3(sMsg, ref Str3, new string[] { "/", "\09" });
                            sMsg = HUtil32.GetValidStr3(sMsg, ref Str4, new string[] { "/", "\09" });
                            sMsg = HUtil32.GetValidStr3(sMsg, ref Str5, new string[] { "/", "\09" });
                            sMsg = HUtil32.GetValidStr3(sMsg, ref Str6, new string[] { "/", "\09" });
                            nItemId = HUtil32.Str_ToInt(Str, 0);// 主材料
                            nItemId1 = HUtil32.Str_ToInt(Str1, 0);// 酒曲
                            nItemId2 = HUtil32.Str_ToInt(Str2, 0);// 水
                            nItemId3 = HUtil32.Str_ToInt(Str3, 0);// 酒坛
                            nItemId4 = HUtil32.Str_ToInt(Str4, 0);// 辅助材料1
                            nItemId5 = HUtil32.Str_ToInt(Str5, 0);// 辅助材料2
                            nItemId6 = HUtil32.Str_ToInt(Str6, 0);// 辅助材料3
                            Check = 1;
                            if (this.m_ItemList.Count > 0)
                            {
                                for (I = 0; I < this.m_ItemList.Count; I++)
                                {
                                    Check = 2;
                                    UserItem = (TUserItem*)this.m_ItemList[I];
                                    Check = 3;
                                    if (UserItem != null)
                                    {
                                        if (UserItem->MakeIndex == nItemId)
                                        {
                                            StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                                        }
                                        else if (UserItem->MakeIndex == nItemId1)
                                        {
                                            StdItem1 = UserEngine.GetStdItem(UserItem->wIndex);
                                        }
                                        else if (UserItem->MakeIndex == nItemId2)
                                        {
                                            StdItem2 = UserEngine.GetStdItem(UserItem->wIndex);
                                        }
                                        else if (UserItem->MakeIndex == nItemId3)
                                        {
                                            StdItem3 = UserEngine.GetStdItem(UserItem->wIndex);
                                        }
                                        else if (UserItem->MakeIndex == nItemId4)
                                        {
                                            StdItem4 = UserEngine.GetStdItem(UserItem->wIndex);
                                        }
                                        else if (UserItem->MakeIndex == nItemId5)
                                        {
                                            StdItem5 = UserEngine.GetStdItem(UserItem->wIndex);
                                        }
                                        else if (UserItem->MakeIndex == nItemId6)
                                        {
                                            StdItem6 = UserEngine.GetStdItem(UserItem->wIndex);
                                        }
                                    }
                                }
                            }
                            Check = 4;
                            if ((StdItem != null) && (StdItem2 != null) && (StdItem3 != null) && (StdItem4 != null) && (StdItem5 != null) && (StdItem6 != null))
                            {
                                Check = 5;
                                if ((StdItem->StdMode == 8) && (StdItem2->StdMode == 9) && ((StdItem3->StdMode == 12) && (StdItem3->Shape == 0))
                                    && (StdItem4->StdMode == 8) && (StdItem5->StdMode == 8) && (StdItem6->StdMode == 8))
                                {
                                    n_MakeWineQuality = (byte)StdItem->AC;
                                    // 主料的品质值
                                    if (StdItem2->Shape == 1)
                                    {
                                        n_MakeWineQuality = Convert.ToByte(n_MakeWineQuality + 1);// 使用泉水品质+1
                                    }
                                    Check = 6;
                                    m_boMakeWine = true;// 是否酿酒
                                    m_MakeWineTime = (ushort)GameConfig.nMakeWineTime;// 酿酒等待的时间
                                    n_MakeWineItmeType = StdItem->AniCount;// 酿酒后,应该可以得到酒的类型
                                    n_MakeWineType = 1;// 酿酒的类型 1-普通酒 2-药酒
                                    if (StdItem1 != null)
                                    {
                                        // 判断酒曲是否是与主材料对应,对应则加品质+1
                                        if ((StdItem1->Shape == StdItem->AniCount) && (HUtil32.Random(3) == 0))
                                        {
                                            n_MakeWineQuality = Convert.ToByte(n_MakeWineQuality + 1);
                                        }
                                    }
                                    if (StdItem->Source == 1)
                                    {
                                        // 精制材料可以得到酒的品质
                                        nC = ClientPlayMakeWine_GetRandomRange(3, 5);
                                        n_MakeWineQuality = Convert.ToByte(n_MakeWineQuality + nC);
                                        if (n_MakeWineQuality > 10)
                                        {
                                            n_MakeWineQuality = 10;
                                        }
                                    }
                                    else
                                    {
                                        nC = ClientPlayMakeWine_GetRandomRange(3, 4); // 普通材料
                                        n_MakeWineQuality = Convert.ToByte(n_MakeWineQuality + nC);// 可以得到酒的品质
                                        if (n_MakeWineQuality > 5)
                                        {
                                            n_MakeWineQuality = 5;
                                        }
                                    }
                                    if (n_MakeWineQuality == 0)
                                    {
                                        n_MakeWineQuality = 1;
                                    }
                                    n_MakeWineAlcohol = Convert.ToByte(StdItem->Reserved + StdItem4->Reserved + HUtil32.Random(StdItem5->Reserved)
                                        + HUtil32.Random(StdItem6->Reserved));// 可以得到酒的酒精度
                                    if (n_MakeWineAlcohol > 100)
                                    {
                                        n_MakeWineAlcohol = Convert.ToByte(HUtil32.Random(30) + 30);
                                    }
                                    boMakeWine = true;
                                    Check = 7;
                                }
                            }
                            if (boMakeWine)
                            {
                                for (I = this.m_ItemList.Count - 1; I >= 0; I--)
                                {
                                    if (this.m_ItemList.Count <= 0)
                                    {
                                        break;
                                    }
                                    Check = 8;
                                    UserItem = (TUserItem*)this.m_ItemList[I];
                                    Check = 9;
                                    if (UserItem != null)
                                    {
                                        if ((UserItem->MakeIndex == nItemId) || (UserItem->MakeIndex == nItemId1) || (UserItem->MakeIndex == nItemId2) || (UserItem->MakeIndex == nItemId3)
                                            || (UserItem->MakeIndex == nItemId4) || (UserItem->MakeIndex == nItemId5) || (UserItem->MakeIndex == nItemId6))
                                        {
                                            StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                                            if (StdItem != null)
                                            {
                                                Check = 10;
                                                SendDelItems(UserItem);
                                                Check = 11;
                                                Marshal.FreeHGlobal((IntPtr)UserItem);
                                                Check = 12;
                                                this.m_ItemList.RemoveAt(I);
                                            }
                                        }
                                    }
                                }
                            }
                            break;
                        case 1:// 药酒
                            sMsg = HUtil32.GetValidStr3(sMsg, ref Str, new string[] { "/", "\09" });
                            sMsg = HUtil32.GetValidStr3(sMsg, ref Str1, new string[] { "/", "\09" });
                            nItemId = HUtil32.Str_ToInt(Str, 0);// 药材
                            nItemId1 = HUtil32.Str_ToInt(Str1, 0);// 酒
                            nItemId2 = HUtil32.Str_ToInt(sMsg, 0);// 酒瓶
                            if (this.m_ItemList.Count > 0)
                            {
                                for (I = 0; I < this.m_ItemList.Count; I++)
                                {
                                    UserItem = (TUserItem*)this.m_ItemList[I];
                                    if (UserItem != null)
                                    {
                                        if (UserItem->MakeIndex == nItemId)
                                        {
                                            StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                                        }
                                        else if (UserItem->MakeIndex == nItemId1)
                                        {
                                            StdItem1 = UserEngine.GetStdItem(UserItem->wIndex);
                                            if ((StdItem1->StdMode == 60) && (StdItem1->Shape != 0))// 普通酒
                                            {
                                                if ((UserItem->btValue[0] > 5) &&
                                                    (UserItem->Dura == UserItem->DuraMax))// 普通酒品质达6以上,并且没喝过,才做酿造药酒
                                                {
                                                    boMakeWineOK = true;
                                                    n_MakeWineQuality = UserItem->btValue[0];// 可以得到酒的品质
                                                    n_MakeWineAlcohol = UserItem->btValue[1];// 可以得到酒的酒精度
                                                    if (n_MakeWineAlcohol > 100)
                                                    {
                                                        n_MakeWineAlcohol = Convert.ToByte(HUtil32.Random(30) + 30);
                                                    }
                                                }
                                            }
                                        }
                                        else if (UserItem->MakeIndex == nItemId2)
                                        {
                                            StdItem2 = UserEngine.GetStdItem(UserItem->wIndex);
                                        }
                                    }
                                }
                            }
                            if ((StdItem != null) && (StdItem1 != null) && (StdItem2 != null))
                            {
                                if ((StdItem->StdMode == 14) && boMakeWineOK && ((StdItem2->StdMode == 12) && (StdItem2->Shape == 1)))
                                {
                                    m_boMakeWine = true;// 是否酿酒
                                    m_MakeWineTime = (ushort)GameConfig.nMakeWineTime1;// 酿药酒等待的时间
                                    n_MakeWineItmeType = StdItem->AniCount;// 酿酒后,应该可以得到酒的类型
                                    n_MakeWineType = 2;// 酿酒的类型 1-普通酒 2-药酒
                                    boMakeWine = true;//酿造成功
                                }
                            }
                            if (!boMakeWine)
                            {
                                n_MakeWineQuality = 0;// 可以得到酒的品质
                                n_MakeWineAlcohol = 0;// 可以得到酒的酒精度
                            }
                            else
                            {
                                for (I = this.m_ItemList.Count - 1; I >= 0; I--)
                                {
                                    if (this.m_ItemList.Count <= 0)
                                    {
                                        break;
                                    }
                                    Check = 18;
                                    UserItem = (TUserItem*)this.m_ItemList[I];
                                    Check = 19;
                                    if (UserItem != null)
                                    {
                                        if ((UserItem->MakeIndex == nItemId) || (UserItem->MakeIndex == nItemId1) || (UserItem->MakeIndex == nItemId2))
                                        {
                                            StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                                            if (StdItem != null)
                                            {
                                                Check = 20;
                                                SendDelItems(UserItem);
                                                Check = 21;
                                                Marshal.FreeHGlobal((IntPtr)UserItem);
                                                Check = 22;
                                                this.m_ItemList.RemoveAt(I);
                                            }
                                        }
                                    }
                                }
                            }
                            break;
                    }
                }
                // 材料全对应上后,提示玩家开始酿造,需等待一会,并发个消息给客户端把窗口关掉
                if (boMakeWine)// 酿造成功
                {
                    this.SendMsg(this, Grobal2.RM_MAKEWINE_OK, 0, nCode, 0, 0, "");// 酿造成功
                    if (M2Share.g_FunctionNPC != null)
                    {
                        M2Share.g_FunctionNPC.GotoLable(this, "@BeginMakeWine", false);// 酿造成功
                    }
                }
                else // 酿酒失败
                {
                    this.SendMsg(this, Grobal2.RM_MAKEWINE_FAIL, 0, nCode, 0, 0, "");// 酿造失败
                    if (m_boMakeWine) // 已经有酒在酿中
                    {
                        if (M2Share.g_FunctionNPC != null)
                        {
                            M2Share.g_FunctionNPC.GotoLable(this, "@MakeWineFail", false);// 酿造失败
                        }
                    }
                    else
                    {
                        if (M2Share.g_FunctionNPC != null)
                        {
                            M2Share.g_FunctionNPC.GotoLable(this, "@MakeWineFail1", false);// 酿造失败
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.ClientPlayMakeWine Code:" + (Check).ToString());
            }
        }

        /// <summary>
        /// 先判断玩家毒符位是否有泉水罐,然后判断是否在泉眼上,最后记时,到时间加泉水
        /// </summary>
        private unsafe void PlayGatherFountain()
        {
            TStdItem* StdItem;
            if ((this.m_UseItems[TPosition.U_BUJUK]->wIndex > 0) && (this.m_UseItems[TPosition.U_BUJUK]->Dura != this.m_UseItems[TPosition.U_BUJUK]->DuraMax))
            {
                StdItem = UserEngine.GetStdItem(this.m_UseItems[TPosition.U_BUJUK]->wIndex);
                if (StdItem != null)
                {
                    if ((StdItem->StdMode == 2) && (StdItem->AniCount == 21) && (StdItem->Reserved == 56)) // 有泉水罐
                    {
                        if (M2Share.g_EventManager.GetEvent(this.m_PEnvir, this.m_nCurrX, this.m_nCurrY, Grobal2.ET_FOUNTAIN) != null)// 判断玩家是在泉眼上
                        {
                            n_InFountainTime++;// 累积站在泉眼上的时间
                            if (n_InFountainTime >= GameConfig.nInFountainTime) // 达到累积时间,则增加泉水罐的持久
                            {
                                this.m_UseItems[TPosition.U_BUJUK]->Dura += 100;
                                if (this.m_MyGuild != null)
                                {
                                    this.m_MyGuild.boChanged = true;
                                    this.m_MyGuild.m_nGuildFountain++;// 累积行会泉水
                                }
                                if (this.m_UseItems[TPosition.U_BUJUK]->Dura > this.m_UseItems[TPosition.U_BUJUK]->DuraMax)
                                {
                                    this.m_UseItems[TPosition.U_BUJUK]->Dura = this.m_UseItems[TPosition.U_BUJUK]->DuraMax;
                                }
                                this.SendMsg(this, Grobal2.RM_DURACHANGE, TPosition.U_BUJUK, this.m_UseItems[TPosition.U_BUJUK]->Dura, this.m_UseItems[TPosition.U_BUJUK]->DuraMax, 0, "");
                                this.SendRefMsg(Grobal2.RM_MYSHOW, 10, 0, 0, 0, "");// 采集到泉水动画
                                n_InFountainTime = 0;
                            }
                        }
                        else
                        {
                            n_InFountainTime = 0;
                        }
                    }
                }
            }
            else if (n_InFountainTime != 0)
            {
                n_InFountainTime = 0;
            }
        }

        /// <summary>
        /// 发送删除挑战框中物品后,给客户端更新
        /// </summary>
        /// <param name="UserItem"></param>
        private unsafe void SendDelChallengeItem(TUserItem* UserItem)
        {
            TStdItem* StdItem;
            TClientItem* ClientItem = null;
            TOClientItem* OClientItem = null;
            string sUserItemName;
            SendDefMessage(Grobal2.SM_CHALLENGEDELITEM_OK, 0, 0, 0, 0, "");
            if (m_ChallengeCreat != null)
            {
                if (m_ChallengeCreat.m_nSoftVersionDateEx == 0)
                {
                    StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                    if (StdItem != null)
                    {
                        M2Share.CopyStdItemToOStdItem(StdItem, &OClientItem->s);// 取自定义物品名称
                        sUserItemName = "";
                        if (UserItem->btValue[13] == 1)
                        {
                            sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                        }
                        if (sUserItemName != "")
                        {
                            HUtil32.StrToSByteArry(sUserItemName, OClientItem->s.Name, 14, ref OClientItem->s.NameLen);
                        }
                        OClientItem->MakeIndex = UserItem->MakeIndex;
                        OClientItem->Dura = UserItem->Dura;
                        OClientItem->DuraMax = UserItem->DuraMax;
                    }
                    this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_CHALLENGEREMOTEDELITEM, HUtil32.ObjectToInt(this), 0, 0, 1, 0);
                    byte[] data = new byte[sizeof(TOClientItem)];
                    fixed (byte* pb = data)
                    {
                        *(TOClientItem*)pb = *OClientItem;
                    }

                    m_ChallengeCreat.SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TOClientItem)));

                }
                else
                {
                    StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                    if (StdItem != null)
                    {
                        ClientItem->s = *StdItem;// 取自定义物品名称
                        sUserItemName = "";
                        if (UserItem->btValue[13] == 1)
                        {
                            sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                        }
                        if (sUserItemName != "")
                        {
                            HUtil32.StrToSByteArry(sUserItemName, ClientItem->s.Name, 14, ref ClientItem->s.NameLen);
                            //ClientItem->s->Name = sUserItemName;
                        }
                        if (UserItem->btValue[12] == 1) // 物品发光
                        {
                            ClientItem->s.Reserved1 = 1;
                        }
                        else
                        {
                            ClientItem->s.Reserved1 = 0;
                        }
                        if ((StdItem->StdMode == 60) && (StdItem->Shape != 0))  // 酒类,除烧酒外
                        {
                            if (UserItem->btValue[0] != 0)
                            {
                                ClientItem->s.AC = UserItem->btValue[0];// 酒的品质
                            }
                            if (UserItem->btValue[1] != 0)
                            {
                                ClientItem->s.MAC = UserItem->btValue[1]; // 酒的酒精度
                            }
                        }
                        ClientItem->MakeIndex = UserItem->MakeIndex;
                        ClientItem->Dura = UserItem->Dura;
                        ClientItem->DuraMax = UserItem->DuraMax;
                    }
                    this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_CHALLENGEREMOTEDELITEM, HUtil32.ObjectToInt(this), 0, 0, 1, 0);

                    byte[] data = new byte[sizeof(TClientItem)];
                    fixed (byte* pb = data)
                    {
                        *(TClientItem*)pb = *ClientItem;
                    }
                    ((m_ChallengeCreat) as TPlayObject).SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TClientItem)));
                }
                m_ChallengeCreat.m_ChallengeLastTick = HUtil32.GetTickCount();
                m_ChallengeLastTick = HUtil32.GetTickCount();
            }
        }

        /// <summary>
        /// 发送抵押的挑战物品
        /// </summary>
        /// <param name="UserItem"></param>
        private unsafe void SendAddChallengeItem(TUserItem* UserItem)
        {
            TStdItem* StdItem;
            TStdItem* StdItem80;
            TClientItem* ClientItem = null;
            TOClientItem* OClientItem = null;
            string sUserItemName;
            SendDefMessage(Grobal2.SM_CHALLENGEADDITEM_OK, 0, 0, 0, 0, "");
            if (m_ChallengeCreat != null)
            {
                if (m_ChallengeCreat.m_nSoftVersionDateEx == 0)
                {
                    StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                    if (StdItem != null)
                    {
                        StdItem80 = StdItem;// 取自定义物品名称
                        sUserItemName = "";
                        if (UserItem->btValue[13] == 1)
                        {
                            sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                        }
                        if (sUserItemName != "")
                        {
                            HUtil32.StrToSByteArry(sUserItemName, StdItem80->Name, 14, ref StdItem80->NameLen);
                            //StdItem80->Name = sUserItemName;
                        }
                        ItemUnit.GetItemAddValue(UserItem, StdItem80);
                        M2Share.CopyStdItemToOStdItem(StdItem80, &OClientItem->s);
                        OClientItem->MakeIndex = UserItem->MakeIndex;
                        OClientItem->Dura = UserItem->Dura;
                        OClientItem->DuraMax = UserItem->DuraMax;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_CHALLENGEREMOTEADDITEM, HUtil32.ObjectToInt(this), 0, 0, 1, 0);
                        byte[] data = new byte[sizeof(TOClientItem)];
                        fixed (byte* pb = data)
                        {
                            *(TOClientItem*)pb = *OClientItem;
                        }

                        m_ChallengeCreat.SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TOClientItem)));

                        m_ChallengeCreat.m_ChallengeLastTick = HUtil32.GetTickCount();
                        m_ChallengeLastTick = HUtil32.GetTickCount();
                    }
                }
                else
                {
                    StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                    if (StdItem != null)
                    {
                        StdItem80 = StdItem;
                        ItemUnit.GetItemAddValue(UserItem, StdItem80);// 取自定义物品名称
                        sUserItemName = "";
                        if (UserItem->btValue[13] == 1)
                        {
                            sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                        }
                        if (sUserItemName != "")
                        {
                            HUtil32.StrToSByteArry(sUserItemName, StdItem80->Name, 14, ref StdItem80->NameLen);
                            //StdItem80->Name = sUserItemName;
                        }
                        if (UserItem->btValue[12] == 1)// 物品发光
                        {
                            StdItem80->Reserved1 = 1;
                        }
                        else
                        {
                            StdItem80->Reserved1 = 0;
                        }
                        if ((StdItem->StdMode == 60) && (StdItem->Shape != 0))// 酒类,除烧酒外
                        {
                            if (UserItem->btValue[0] != 0)
                            {
                                ClientItem->s.AC = UserItem->btValue[0];// 酒的品质
                            }
                            if (UserItem->btValue[1] != 0)
                            {
                                ClientItem->s.MAC = UserItem->btValue[1]; // 酒的酒精度
                            }
                        }
                        ClientItem->s = *StdItem80;
                        ClientItem->MakeIndex = UserItem->MakeIndex;
                        ClientItem->Dura = UserItem->Dura;
                        ClientItem->DuraMax = UserItem->DuraMax;
                        this.m_DefMsg = EncryptUnit.MakeDefaultMsg(Grobal2.SM_CHALLENGEREMOTEADDITEM, HUtil32.ObjectToInt(this), 0, 0, 1, 0);

                        byte[] data = new byte[sizeof(TClientItem)];
                        fixed (byte* pb = data)
                        {
                            *(TClientItem*)pb = *ClientItem;
                        }
                        m_ChallengeCreat.SendSocket(this.m_DefMsg, EncryptUnit.EncodeBuffer(data, sizeof(TClientItem)));

                        m_ChallengeCreat.m_ChallengeLastTick = HUtil32.GetTickCount();
                        m_ChallengeLastTick = HUtil32.GetTickCount();
                    }
                }
            }
        }

        // 判断玩家是否面对面,是则弹出抵物品窗口
        private void ClientChallenge()
        {
            TBaseObject BaseObject;
            TPlayObject PlayObject;
            if (m_boChallengeing || (m_ChallengeCreat != null))
            {
                return;
            }
            // 如果正在挑战则退出
            if (HUtil32.GetTickCount() - m_ChallengeLastTick < 3000)
            {
                // '请稍后再挑战'
                this.SendMsg(M2Share.g_ManageNPC, Grobal2.RM_MENU_OK, 0, this.ToInt(), 0, 0, GameMsgDef.g_sPleaseTryChallengeLaterMsg);
                return;
            }
            BaseObject = this.GetPoseCreate();// 取面前对像
            if ((BaseObject != null) && (BaseObject != this) && (BaseObject.m_btRaceServer == Grobal2.RC_PLAYOBJECT))
            {
                PlayObject = ((BaseObject) as TPlayObject);
                if ((PlayObject != null) && (PlayObject.GetPoseCreate() == this))
                {
                    ((this) as TPlayObject).OpenChallengeDlg(PlayObject);// 打开挑战抵押物品窗口
                    PlayObject.OpenChallengeDlg(this);// 打开挑战抵押物品窗口
                }
                else
                {
                    SendDefMessage(Grobal2.SM_CHALLENGE_FAIL, 0, 0, 0, 0, "");
                }
            }
            else
            {
                SendDefMessage(Grobal2.SM_CHALLENGE_FAIL, 0, 0, 0, 0, "");
            }
        }

        // 判断玩家是否面对面,是则弹出抵物品窗口
        // 打开挑战抵押物品窗口
        private void OpenChallengeDlg(TPlayObject PlayObject)
        {
            m_boChallengeing = true;
            m_ChallengeCreat = PlayObject;
            GetBackChallengeItems();
            SendDefMessage(Grobal2.SM_CHALLENGEMENU, 0, 0, 0, 0, m_ChallengeCreat.m_sCharName);
            m_ChallengeLastTick = HUtil32.GetTickCount();
        }

        /// <summary>
        /// 取回之前抵押物品
        /// </summary>
        public unsafe void GetBackChallengeItems()
        {
            TUserItem* UserItem;
            if (m_ChallengeItemList.Count > 0)
            {
                for (int I = 0; I < m_ChallengeItemList.Count; I++)
                {
                    UserItem = (TUserItem*)m_ChallengeItemList[I];
                    if (UserItem != null)
                    {
                        this.m_ItemList.Add((IntPtr)UserItem);
                        SendAddItem(UserItem);
                    }
                }
            }
            m_ChallengeItemList.Clear();
            this.m_nGold += m_nChallengeGolds;
            m_nChallengeGolds = 0;
            m_nGAMEDIAMOND += m_nChallengeGAMEDIAMOND;
            m_nChallengeGAMEDIAMOND = 0;
            m_boChallengeOK = false;
        }

        // 打开挑战抵押物品窗口
        // 客户端增加抵押物品到挑战框中
        private unsafe void ClientAddChallengeItem(int nItemIdx, string sItemName)
        {
            bool bo11;
            TUserItem* UserItem;
            string sUserItemName;
            if ((m_ChallengeCreat == null) || !m_boChallengeing)
            {
                return;
            }
            m_boCanQueryBag = true;// 增加挑战物品时,不能刷新包裹
            try
            {
                if (sItemName.IndexOf(" ") >= 0)
                {
                    // 折分物品名称(信件物品的名称后面加了使用次数)
                    HUtil32.GetValidStr3(sItemName, ref sItemName, new string[] { " " });
                }
                bo11 = false;
                if (!m_ChallengeCreat.m_boChallengeOK)
                {
                    for (int I = this.m_ItemList.Count - 1; I >= 0; I--)
                    {
                        if (this.m_ItemList.Count <= 0)
                        {
                            break;
                        }
                        UserItem = (TUserItem*)this.m_ItemList[I];
                        if (UserItem == null)
                        {
                            continue;
                        }
                        if (UserItem->MakeIndex == nItemIdx)
                        {
                            // 取自定义物品名称
                            sUserItemName = "";
                            if (UserItem->btValue[13] == 1)
                            {
                                sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                            }
                            if (sUserItemName == "")
                            {
                                sUserItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                            }
                            if (((sUserItemName).ToLower().CompareTo((sItemName).ToLower()) == 0) && (m_ChallengeItemList.Count < 5))
                            {
                                if (this.CheckItemValue(UserItem, 1)) // 禁止交易
                                {
                                    break;
                                }
                                else if (this.PlugOfCheckCanItem(1, sUserItemName, false, 0, 0)) // 禁止物品规则(管理插件功能)
                                {
                                    break;
                                }
                                m_ChallengeItemList.Add((IntPtr)UserItem);
                                this.SendAddChallengeItem(UserItem); // 发送抵押的挑战物品
                                //((this) as TPlayObject).SendAddChallengeItem(UserItem);
                                this.m_ItemList.RemoveAt(I);
                                ClearCopyItem(0, UserItem->wIndex, UserItem->MakeIndex);// 清理包裹和仓库复制物品
                                bo11 = true;
                                break;
                            }
                        }
                    }
                }
                if (!bo11)
                {
                    SendDefMessage(Grobal2.SM_CHALLENGEADDITEM_FAIL, 0, 0, 0, 0, "");
                }
            }
            finally
            {
                m_boCanQueryBag = false;// 增加挑战物品时,不能刷新包裹
            }
        }

        // 客户端增加抵押物品到挑战框中
        // 客户端删除抵押的挑战物品
        private unsafe void ClientDelChallengeItem(int nItemIdx, string sItemName)
        {
            bool bo11;
            TUserItem* UserItem;
            string sUserItemName;
            if ((m_ChallengeCreat == null) || !m_boChallengeing)
            {
                return;
            }
            if (sItemName.IndexOf(" ") >= 0)
            {
                // 折分物品名称(信件物品的名称后面加了使用次数)
                HUtil32.GetValidStr3(sItemName, ref sItemName, new string[] { " " });
            }
            bo11 = false;
            if (!m_ChallengeCreat.m_boChallengeOK)
            {
                for (int I = m_ChallengeItemList.Count - 1; I >= 0; I--)
                {
                    if (m_ChallengeItemList.Count <= 0)
                    {
                        break;
                    }
                    UserItem = (TUserItem*)m_ChallengeItemList[I];
                    if (UserItem == null)
                    {
                        continue;
                    }
                    if (UserItem->MakeIndex == nItemIdx)
                    {
                        // 取自定义物品名称
                        sUserItemName = "";
                        if (UserItem->btValue[13] == 1)
                        {
                            sUserItemName = ItemUnit.GetCustomItemName(UserItem->MakeIndex, UserItem->wIndex);
                        }
                        if (sUserItemName == "")
                        {
                            sUserItemName = UserEngine.GetStdItemName(UserItem->wIndex);
                        }
                        if ((sUserItemName).ToLower().CompareTo((sItemName).ToLower()) == 0)
                        {
                            this.m_ItemList.Add((IntPtr)UserItem);
                            this.SendDelChallengeItem(UserItem);// 发送删除抵押的挑战物品
                            //((this) as TPlayObject).SendDelChallengeItem(UserItem); 
                            m_ChallengeItemList.RemoveAt(I);
                            bo11 = true;
                            break;
                        }
                    }
                }
            }
            if (!bo11)
            {
                SendDefMessage(Grobal2.SM_CHALLENGEDELITEM_FAIL, 0, 0, 0, 0, "");
            }
        }

        /// <summary>
        /// 挑战取消
        /// </summary>
        private void ChallengeCancel()
        {
            if (!m_boChallengeing)
            {
                return;
            }
            m_boChallengeing = false;
            SendDefMessage(Grobal2.SM_CHALLENGECANCEL, 0, 0, 0, 0, "");
            if (m_ChallengeCreat != null)
            {
                m_ChallengeCreat.ChallengeCancel();
            }
            m_ChallengeCreat = null;
            GetBackChallengeItems();
            this.SysMsg(GameMsgDef.g_sChallengeActionCancelMsg, TMsgColor.c_Green, TMsgType.t_Hint);// '挑战取消'
            m_ChallengeLastTick = HUtil32.GetTickCount();
        }

        /// <summary>
        /// 客户端取消挑战
        /// </summary>
        private void ClientCancelChallenge()
        {
            ChallengeCancel();
        }

        /// <summary>
        /// 客户端把金币放到挑战框中
        /// </summary>
        /// <param name="nGold"></param>
        private void ClientChangeChallengeGold(int nGold)
        {
            bool bo09;
            // 禁止取回放入挑战栏内的金币
            if ((m_nChallengeGolds > 0) && GameConfig.boCanNotGetBackDeal)
            {
                this.SendMsg(M2Share.g_ManageNPC, Grobal2.RM_MENU_OK, 0, this.ToInt(), 0, 0, GameMsgDef.g_sChallengeItemsDenyGetBackMsg);
                SendDefMessage(Grobal2.SM_CHALLENGEDELITEM_FAIL, 0, 0, 0, 0, "");
                return;
            }
            if (nGold < 0)
            {
                SendDefMessage(Grobal2.SM_CHALLENCHGGOLD_FAIL, m_nChallengeGolds, (ushort)HUtil32.LoWord(this.m_nGold), (ushort)HUtil32.HiWord(this.m_nGold), 0, "");
                return;
            }
            bo09 = false;
            if ((m_ChallengeCreat != null) && (this.GetPoseCreate() == m_ChallengeCreat))
            {
                if (!m_ChallengeCreat.m_boChallengeOK)
                {
                    if ((this.m_nGold + m_nChallengeGolds) >= nGold)
                    {
                        this.m_nGold = (this.m_nGold + m_nChallengeGolds) - nGold;
                        m_nChallengeGolds = nGold;
                        SendDefMessage(Grobal2.SM_CHALLENCHGGOLD_OK, m_nChallengeGolds, (ushort)HUtil32.LoWord(this.m_nGold), (ushort)HUtil32.HiWord(this.m_nGold), 0, "");
                        m_ChallengeCreat.SendDefMessage(Grobal2.SM_CHALLENREMOTECHGGOLD, m_nChallengeGolds, 0, 0, 0, "");
                        m_ChallengeCreat.m_ChallengeLastTick = HUtil32.GetTickCount();
                        bo09 = true;
                        m_ChallengeLastTick = HUtil32.GetTickCount();
                    }
                }
            }
            if (!bo09)
            {
                SendDefMessage(Grobal2.SM_CHALLENCHGGOLD_FAIL, m_nChallengeGolds, this.m_nGold, (ushort)HUtil32.HiWord(this.m_nGold), 0, "");
            }
        }

        /// <summary>
        /// 客户端把金刚石放到挑战框中
        /// </summary>
        /// <param name="nDIAMOND"></param>
        private void ClientChangeChallengeDIAMOND(int nDIAMOND)
        {
            bool bo09;
            if (nDIAMOND < 0)
            {
                SendDefMessage(Grobal2.SM_CHALLENCHGDIAMOND_FAIL, m_nChallengeGAMEDIAMOND, (ushort)HUtil32.LoWord(m_nGAMEDIAMOND), (ushort)HUtil32.HiWord(m_nGAMEDIAMOND), 0, "");
                return;
            }
            bo09 = false;
            if ((m_ChallengeCreat != null) && (this.GetPoseCreate() == m_ChallengeCreat))
            {
                if (!m_ChallengeCreat.m_boChallengeOK)
                {
                    if ((m_nGAMEDIAMOND + m_nChallengeGAMEDIAMOND) >= nDIAMOND)
                    {
                        m_nGAMEDIAMOND = (m_nGAMEDIAMOND + m_nChallengeGAMEDIAMOND) - nDIAMOND;
                        m_nChallengeGAMEDIAMOND = nDIAMOND;
                        SendDefMessage(Grobal2.SM_CHALLENCHGDIAMOND_OK, m_nChallengeGAMEDIAMOND, (ushort)HUtil32.LoWord(m_nGAMEDIAMOND), (ushort)HUtil32.HiWord(m_nGAMEDIAMOND), 0, "");
                        m_ChallengeCreat.SendDefMessage(Grobal2.SM_CHALLENREMOTECHGDIAMOND, m_nChallengeGAMEDIAMOND, 0, 0, 0, "");
                        m_ChallengeCreat.m_ChallengeLastTick = HUtil32.GetTickCount();
                        bo09 = true;
                        m_ChallengeLastTick = HUtil32.GetTickCount();
                    }
                }
            }
            if (!bo09)
            {
                SendDefMessage(Grobal2.SM_CHALLENCHGDIAMOND_FAIL, m_nChallengeGAMEDIAMOND, (ushort)HUtil32.LoWord(m_nGAMEDIAMOND), (ushort)HUtil32.HiWord(m_nGAMEDIAMOND), 0, "");
            }
        }

        /// <summary>
        /// 挑战抵押物品结束
        /// </summary>
        private void ClientChallengeEnd()
        {
            bool bo11;
            m_boChallengeOK = true;
            if (m_ChallengeCreat == null)
            {
                return;
            }
            if (((HUtil32.GetTickCount() - m_ChallengeLastTick) < 1000) || ((HUtil32.GetTickCount() - m_ChallengeCreat.m_ChallengeLastTick) < 1000))
            {
                this.SysMsg(GameMsgDef.g_sChallengeOKTooFast, TMsgColor.c_Red, TMsgType.t_Hint); // '过早按了确定按钮。'
                ChallengeCancel();
                return;
            }
            if (m_ChallengeCreat.m_boChallengeOK)
            {
                bo11 = true;
                if ((Grobal2.MAXBAGITEM - this.m_ItemList.Count) < m_ChallengeCreat.m_ChallengeItemList.Count)
                {
                    bo11 = false;
                    this.SysMsg(GameMsgDef.g_sChallengeYourBagSizeTooSmall, TMsgColor.c_Red, TMsgType.t_Hint);
                }
                if ((this.m_nGoldMax - this.m_nGold) < m_ChallengeCreat.m_nChallengeGolds)
                {
                    this.SysMsg(GameMsgDef.g_sChallengeYourGoldLargeThenLimit, TMsgColor.c_Red, TMsgType.t_Hint);
                    bo11 = false;
                }
                if ((Grobal2.MAXBAGITEM - m_ChallengeCreat.m_ItemList.Count) < m_ChallengeItemList.Count)
                {
                    this.SysMsg(GameMsgDef.g_sChallengeHumanBagSizeTooSmall, TMsgColor.c_Red, TMsgType.t_Hint);
                    bo11 = false;
                }
                if ((m_ChallengeCreat.m_nGoldMax - m_ChallengeCreat.m_nGold) < m_nChallengeGolds)
                {
                    this.SysMsg(GameMsgDef.g_sChallengeHumanGoldLargeThenLimit, TMsgColor.c_Red, TMsgType.t_Hint);
                    bo11 = false;
                }
                if (bo11)
                {
                    SendDefMessage(Grobal2.SM_CLOSECHALLENGE, 0, 0, 0, 0, "");// 关闭挑战抵押物品窗口
                    m_ChallengeCreat.SendDefMessage(Grobal2.SM_CLOSECHALLENGE, 0, 0, 0, 0, "");// 关闭挑战抵押物品窗口
                    if (M2Share.g_FunctionNPC != null)
                    {
                        M2Share.g_FunctionNPC.GotoLable(this, "@Challenge", false);// 进入触发段(传送挑战地图)
                    }
                }
                else
                {
                    ChallengeCancel();
                }
            }
            else
            {
                this.SysMsg(GameMsgDef.g_sYouChallengeOKMsg, TMsgColor.c_Green, TMsgType.t_Hint);
                m_ChallengeCreat.SysMsg(GameMsgDef.g_sPoseChallengeOKMsg, TMsgColor.c_Green, TMsgType.t_Hint);
            }
        }

        /// <summary>
        /// 胜方取得物品
        /// </summary>
        public unsafe void WinGetChallengeItems()
        {
            TUserItem* UserItem;
            TStdItem* StdItem;
            if (m_ChallengeCreat != null)
            {
                m_ChallengeCreat.m_boChallengeing = false;
                m_boChallengeing = false;
                m_ChallengeCreat.m_ChallengeTime = 0;
                m_ChallengeTime = 0;
                if (m_ChallengeCreat.m_ChallengeItemList.Count > 0)
                {
                    for (int I = 0; I < m_ChallengeCreat.m_ChallengeItemList.Count; I++)
                    {
                        UserItem = (TUserItem*)m_ChallengeCreat.m_ChallengeItemList[I];
                        if (UserItem != null)
                        {
                            StdItem = UserEngine.GetStdItem(UserItem->wIndex);
                            if (StdItem != null)
                            {
                                if (StdItem->NeedIdentify == 1)
                                {
                                    M2Share.AddGameDataLog("36" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString() + "\09" +
                                        (this.m_nCurrY).ToString() + "\09" + this.m_sCharName + "\09" + HUtil32.SBytePtrToString(StdItem->Name, 0, StdItem->NameLen) + "\09" + (UserItem->MakeIndex).ToString()
                                        + "\09" + "(" + (HUtil32.LoWord(StdItem->DC)).ToString() + "/" + (HUtil32.HiWord(StdItem->DC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MC)).ToString()
                                        + "/" + (HUtil32.HiWord(StdItem->MC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->SC)).ToString() + "/" + (HUtil32.HiWord(StdItem->SC)).ToString() + ")"
                                        + "(" + (HUtil32.LoWord(StdItem->AC)).ToString() + "/" + (HUtil32.HiWord(StdItem->AC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MAC)).ToString() + "/"
                                        + (HUtil32.HiWord(StdItem->MAC)).ToString() + ")" + (UserItem->btValue[0]).ToString() + "/" + (UserItem->btValue[1]).ToString() + "/"
                                        + (UserItem->btValue[2]).ToString() + "/" + (UserItem->btValue[3]).ToString() + "/" + (UserItem->btValue[4]).ToString() + "/" +
                                        (UserItem->btValue[5]).ToString() + "/" + (UserItem->btValue[6]).ToString() + "/" + (UserItem->btValue[7]).ToString() + "/" +
                                        (UserItem->btValue[8]).ToString() + "/" + (UserItem->btValue[14]).ToString() + "\09" + m_ChallengeCreat.m_sCharName);
                                }
                            }
                            if (IsEnoughBag())// 人物的包裹是否满了
                            {
                                ClearCopyItem(0, UserItem->wIndex, UserItem->MakeIndex);// 清理包裹和仓库复制物品
                                this.m_ItemList.Add((IntPtr)UserItem);
                                SendAddItem(UserItem);
                            }
                            else if (m_StorageItemList.Count < Grobal2.MAXBAGITEM)  // 保存到仓库里
                            {
                                ClearCopyItem(1, UserItem->wIndex, UserItem->MakeIndex);// 清理包裹和仓库复制物品
                                m_StorageItemList.Add((IntPtr)UserItem);
                            }
                        }
                    }
                }
                m_ChallengeCreat.m_ChallengeItemList.Clear();
                if (m_ChallengeCreat.m_nChallengeGolds > 0)
                {
                    this.m_nGold += m_ChallengeCreat.m_nChallengeGolds;
                    if (M2Share.g_boGameLogGold)
                    {
                        M2Share.AddGameDataLog("36" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString() + "\09" + (this.m_nCurrY).ToString() + "\09" + this.m_sCharName
                            + "\09" + M2Share.sSTRING_GOLDNAME + "\09" + (m_ChallengeCreat.m_nChallengeGolds).ToString() + "\09" + "1" + "\09" + m_ChallengeCreat.m_sCharName);
                    }
                    m_ChallengeCreat.m_nChallengeGolds = 0;
                }
                if (m_ChallengeCreat.m_nChallengeGAMEDIAMOND > 0)
                {
                    m_nGAMEDIAMOND += m_ChallengeCreat.m_nChallengeGAMEDIAMOND;
                    if (M2Share.g_boGameLogGold)
                    {
                        M2Share.AddGameDataLog("36" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString() + "\09" + (this.m_nCurrY).ToString() + "\09" + this.m_sCharName
                            + "\09" + GameConfig.sGameDiaMond + "\09" + (m_ChallengeCreat.m_nChallengeGAMEDIAMOND).ToString() + "\09" + "1" + "\09" + m_ChallengeCreat.m_sCharName);
                    }
                    m_ChallengeCreat.m_nChallengeGAMEDIAMOND = 0;
                }
                m_ChallengeCreat.m_boChallengeOK = false;
                m_ChallengeCreat.m_WAbil.HP = m_ChallengeCreat.m_WAbil.MaxHP;
                m_ChallengeCreat.m_WAbil.MP = m_ChallengeCreat.m_WAbil.MaxMP;
                m_ChallengeCreat.HealthSpellChanged();
                m_ChallengeCreat.m_ChallengeCreat = null;
                m_ChallengeCreat.m_ChallengeLastTick = HUtil32.GetTickCount();
                if (m_ChallengeItemList.Count > 0)
                {
                    for (int I = 0; I < m_ChallengeItemList.Count; I++)
                    {
                        UserItem = (TUserItem*)m_ChallengeItemList[I];
                        if (UserItem != null)
                        {
                            if (IsEnoughBag()) // 人物的包裹是否满了
                            {
                                this.m_ItemList.Add((IntPtr)UserItem);
                                SendAddItem(UserItem);
                            }
                            else if (m_StorageItemList.Count < Grobal2.MAXBAGITEM)
                            {
                                m_StorageItemList.Add((IntPtr)UserItem); // 保存到仓库里
                            }
                        }
                    }
                }
                m_ChallengeItemList.Clear();
                this.m_nGold += m_nChallengeGolds;
                m_nChallengeGolds = 0;
                m_nGAMEDIAMOND += m_nChallengeGAMEDIAMOND;
                m_nChallengeGAMEDIAMOND = 0;
                m_boChallengeOK = false;
                this.m_WAbil.HP = this.m_WAbil.MaxHP;
                this.m_WAbil.MP = this.m_WAbil.MaxMP;
                this.HealthSpellChanged();
                m_ChallengeCreat = null;
                m_ChallengeLastTick = HUtil32.GetTickCount();
                this.GoldChanged();
                this.GameGoldChanged();// 更新金刚石和金币
            }
        }

        /// <summary>
        /// 气血石功能
        /// </summary>
        private unsafe void PlaySuperRock()
        {
            TStdItem* StdItem;
            int nTempDura;
            try
            {
                if ((!this.m_boDeath) && (!this.m_boGhost) && (this.m_WAbil.HP > 0))
                {
                    if ((this.m_UseItems[TPosition.U_CHARM]->wIndex > 0) && (this.m_UseItems[TPosition.U_CHARM]->Dura > 0))
                    {
                        StdItem = UserEngine.GetStdItem(this.m_UseItems[TPosition.U_CHARM]->wIndex);
                        if ((StdItem != null))
                        {
                            if ((StdItem->Shape > 0) && this.m_PEnvir.AllowStdItems(HUtil32.SBytePtrToString(StdItem->Name, 0, StdItem->NameLen)))
                            {
                                switch (StdItem->Shape)
                                {
                                    case 1:// 气血石
                                        if ((this.m_WAbil.MaxHP - this.m_WAbil.HP) >= GameConfig.nStartHPRock) // 改成掉点数启用
                                        {
                                            if (HUtil32.GetTickCount() - dwRockAddHPTick > GameConfig.nHPRockSpell)
                                            {
                                                dwRockAddHPTick = HUtil32.GetTickCount();// 气石加HP间隔
                                                if (this.m_UseItems[TPosition.U_CHARM]->Dura * 10 > GameConfig.nHPRockDecDura)
                                                {
                                                    this.m_WAbil.HP += GameConfig.nRockAddHP;
                                                    nTempDura = this.m_UseItems[TPosition.U_CHARM]->Dura * 10;
                                                    nTempDura -= GameConfig.nHPRockDecDura;
                                                    this.m_UseItems[TPosition.U_CHARM]->Dura = (ushort)HUtil32.Round((double)nTempDura / 10);
                                                    if (this.m_UseItems[TPosition.U_CHARM]->Dura > 0)
                                                    {
                                                        this.SendMsg(this, Grobal2.RM_DURACHANGE, TPosition.U_CHARM, this.m_UseItems[TPosition.U_CHARM]->Dura, this.m_UseItems[TPosition.U_CHARM]->DuraMax, 0, "");
                                                    }
                                                    else
                                                    {
                                                        SendDelItems(this.m_UseItems[TPosition.U_CHARM]);
                                                        //SendDelItems(this.m_UseItems[TPosition.U_CHARM]);
                                                        this.m_UseItems[TPosition.U_CHARM]->wIndex = 0;
                                                    }
                                                }
                                                else
                                                {
                                                    this.m_WAbil.HP += GameConfig.nRockAddHP;
                                                    this.m_UseItems[TPosition.U_CHARM]->Dura = 0;
                                                    SendDelItems(this.m_UseItems[TPosition.U_CHARM]);
                                                    //SendDelItems(this.m_UseItems[TPosition.U_CHARM]);
                                                    this.m_UseItems[TPosition.U_CHARM]->wIndex = 0;
                                                }
                                                if (this.m_WAbil.HP > this.m_WAbil.MaxHP)
                                                {
                                                    this.m_WAbil.HP = this.m_WAbil.MaxHP;
                                                }
                                                this.PlugHealthSpellChanged();
                                            }
                                        }
                                        break;
                                    case 2:
                                        if ((this.m_WAbil.MaxMP - this.m_WAbil.MP) >= GameConfig.nStartMPRock)// 改成掉点数启用
                                        {
                                            if (HUtil32.GetTickCount() - dwRockAddMPTick > GameConfig.nMPRockSpell)
                                            {
                                                dwRockAddMPTick = HUtil32.GetTickCount();// 气石加MP间隔
                                                if (this.m_UseItems[TPosition.U_CHARM]->Dura * 10 > GameConfig.nMPRockDecDura)
                                                {
                                                    this.m_WAbil.MP += GameConfig.nRockAddMP;
                                                    nTempDura = this.m_UseItems[TPosition.U_CHARM]->Dura * 10;
                                                    nTempDura -= GameConfig.nMPRockDecDura;
                                                    this.m_UseItems[TPosition.U_CHARM]->Dura = (ushort)HUtil32.Round((double)nTempDura / 10);
                                                    if (this.m_UseItems[TPosition.U_CHARM]->Dura > 0)
                                                    {
                                                        this.SendMsg(this, Grobal2.RM_DURACHANGE, TPosition.U_CHARM, this.m_UseItems[TPosition.U_CHARM]->Dura, this.m_UseItems[TPosition.U_CHARM]->DuraMax, 0, "");
                                                    }
                                                    else
                                                    {
                                                        SendDelItems(this.m_UseItems[TPosition.U_CHARM]);
                                                        this.m_UseItems[TPosition.U_CHARM]->wIndex = 0;
                                                    }
                                                }
                                                else
                                                {
                                                    this.m_WAbil.MP += GameConfig.nRockAddMP;
                                                    this.m_UseItems[TPosition.U_CHARM]->Dura = 0;
                                                    SendDelItems(this.m_UseItems[TPosition.U_CHARM]);
                                                    this.m_UseItems[TPosition.U_CHARM]->wIndex = 0;
                                                }
                                                if (this.m_WAbil.MP > this.m_WAbil.MaxMP)
                                                {
                                                    this.m_WAbil.MP = this.m_WAbil.MaxMP;
                                                }
                                                this.PlugHealthSpellChanged();
                                            }
                                        }
                                        break;
                                    case 3:
                                        if ((this.m_WAbil.MaxHP - this.m_WAbil.HP) >= GameConfig.nStartHPMPRock)// 改成掉点数启用
                                        {
                                            if (HUtil32.GetTickCount() - dwRockAddHPTick > GameConfig.nHPMPRockSpell)
                                            {
                                                dwRockAddHPTick = HUtil32.GetTickCount();// 气石加HP间隔
                                                if (this.m_UseItems[TPosition.U_CHARM]->Dura * 10 > GameConfig.nHPMPRockDecDura)
                                                {
                                                    this.m_WAbil.HP += GameConfig.nRockAddHPMP;
                                                    nTempDura = this.m_UseItems[TPosition.U_CHARM]->Dura * 10;
                                                    nTempDura -= GameConfig.nHPMPRockDecDura;
                                                    this.m_UseItems[TPosition.U_CHARM]->Dura = (ushort)HUtil32.Round((double)nTempDura / 10);
                                                    if (this.m_UseItems[TPosition.U_CHARM]->Dura > 0)
                                                    {
                                                        this.SendMsg(this, Grobal2.RM_DURACHANGE, TPosition.U_CHARM, this.m_UseItems[TPosition.U_CHARM]->Dura, this.m_UseItems[TPosition.U_CHARM]->DuraMax, 0, "");
                                                    }
                                                    else
                                                    {
                                                        SendDelItems(this.m_UseItems[TPosition.U_CHARM]);
                                                        this.m_UseItems[TPosition.U_CHARM]->wIndex = 0;
                                                    }
                                                }
                                                else
                                                {
                                                    this.m_WAbil.HP += GameConfig.nRockAddHPMP;
                                                    this.m_UseItems[TPosition.U_CHARM]->Dura = 0;
                                                    SendDelItems(this.m_UseItems[TPosition.U_CHARM]);
                                                    this.m_UseItems[TPosition.U_CHARM]->wIndex = 0;
                                                }
                                                if (this.m_WAbil.HP > this.m_WAbil.MaxHP)
                                                {
                                                    this.m_WAbil.HP = this.m_WAbil.MaxHP;
                                                }
                                                this.PlugHealthSpellChanged();
                                            }
                                        }
                                        // ======================================================================
                                        if ((this.m_WAbil.MaxMP - this.m_WAbil.MP) >= GameConfig.nStartHPMPRock)// 改成掉点数启用
                                        {
                                            if (HUtil32.GetTickCount() - dwRockAddMPTick > GameConfig.nHPMPRockSpell)
                                            {
                                                dwRockAddMPTick = HUtil32.GetTickCount();// 气石加MP间隔
                                                if (this.m_UseItems[TPosition.U_CHARM]->Dura * 10 > GameConfig.nHPMPRockDecDura)
                                                {
                                                    this.m_WAbil.MP += GameConfig.nRockAddHPMP;
                                                    nTempDura = this.m_UseItems[TPosition.U_CHARM]->Dura * 10;
                                                    nTempDura -= GameConfig.nHPMPRockDecDura;
                                                    this.m_UseItems[TPosition.U_CHARM]->Dura = (ushort)HUtil32.Round((double)nTempDura / 10);
                                                    if (this.m_UseItems[TPosition.U_CHARM]->Dura > 0)
                                                    {
                                                        this.SendMsg(this, Grobal2.RM_DURACHANGE, TPosition.U_CHARM, this.m_UseItems[TPosition.U_CHARM]->Dura, this.m_UseItems[TPosition.U_CHARM]->DuraMax, 0, "");
                                                    }
                                                    else
                                                    {
                                                        SendDelItems(this.m_UseItems[TPosition.U_CHARM]);
                                                        this.m_UseItems[TPosition.U_CHARM]->wIndex = 0;
                                                    }
                                                }
                                                else
                                                {
                                                    this.m_WAbil.MP += GameConfig.nRockAddHPMP;
                                                    this.m_UseItems[TPosition.U_CHARM]->Dura = 0;
                                                    SendDelItems(this.m_UseItems[TPosition.U_CHARM]);
                                                    this.m_UseItems[TPosition.U_CHARM]->wIndex = 0;
                                                }
                                                if (this.m_WAbil.MP > this.m_WAbil.MaxMP)
                                                {
                                                    this.m_WAbil.MP = this.m_WAbil.MaxMP;
                                                }
                                                this.PlugHealthSpellChanged();
                                            }
                                        }
                                        break;
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.PlaySuperRock");
            }
        }

        /// <summary>
        /// 获取商铺分页数量
        /// </summary>
        /// <param name="nItemListCount"></param>
        /// <returns></returns>
        public int ClientGetShopItemList_GetPageCount(int nItemListCount)
        {
            int result = 0;
            if (nItemListCount > 0)
            {
                result = nItemListCount / 10;
                if ((nItemListCount % 10) > 0)
                {
                    result++;
                }
            }
            return result;
        }

        /// <summary>
        /// 客户端取商铺物品列表
        /// </summary>
        /// <param name="nPage"></param>
        /// <param name="nType"></param>
        private unsafe void ClientGetShopItemList(int nPage, int nType)
        {
            int nPageCount;
            int n01;
            int n02;
            int n03;
            string sSendStr;
            string sSendStr1;
            TShopInfo* pShopInfo;
            TShopInfo* ShopInfo;
            IList<IntPtr> TempList;
            if (m_boCanQueryShopItme)// 是否可以刷新商铺
            {
                return;
            }
            m_boCanQueryShopItme = true; // 是否可以刷新商铺
            try
            {
                try
                {
                    if (M2Share.g_ShopItemList == null)
                    {
                        return;
                    }
                    n01 = 0;
                    n02 = 0;
                    n03 = 0;
                    sSendStr = "";
                    sSendStr1 = "";
                    if (M2Share.g_ShopItemList.Count > 0)
                    {
                        for (int I = 0; I < M2Share.g_ShopItemList.Count; I++)
                        {
                            pShopInfo = (TShopInfo*)M2Share.g_ShopItemList[I];
                            ShopInfo = pShopInfo;
                            if (Convert.ToInt32(ShopInfo->Idx) == nType)
                            {
                                n03++;
                            }
                        }
                    }
                    nPageCount = ClientGetShopItemList_GetPageCount(n03);
                    if (nPage > 0)
                    {
                        if (M2Share.g_ShopItemList.Count >= nPage * 10)
                        {
                            TempList = new List<IntPtr>();
                            try
                            {
                                for (int I = 0; I < M2Share.g_ShopItemList.Count; I++)
                                {
                                    pShopInfo = (TShopInfo*)M2Share.g_ShopItemList[I];
                                    ShopInfo = pShopInfo;
                                    if (Convert.ToInt32(ShopInfo->Idx) == nType)
                                    {
                                        TempList.Add((IntPtr)pShopInfo);
                                    }
                                }
                                for (int I = nPage * 10; I < TempList.Count; I++)
                                {
                                    pShopInfo = ((TShopInfo*)(TempList[I]));
                                    ShopInfo = pShopInfo;
                                    n01++;
                                    byte[] data = new byte[sizeof(TShopInfo)];
                                    fixed (byte* pb = data)
                                    {
                                        *(TShopInfo*)pb = *ShopInfo;
                                    }
                                    sSendStr = sSendStr + EncryptUnit.EncodeBuffer(data, sizeof(TShopInfo)) + "/";
                                    if (n01 >= 10)
                                    {
                                        break;
                                    }
                                }
                            }
                            finally
                            {
                                Dispose(TempList);
                            }
                        }
                    }
                    else
                    {
                        if (M2Share.g_ShopItemList.Count > 0)
                        {
                            for (int I = 0; I < M2Share.g_ShopItemList.Count; I++)
                            {
                                pShopInfo = ((TShopInfo*)(M2Share.g_ShopItemList[I]));
                                ShopInfo = pShopInfo;
                                if (Convert.ToInt32(ShopInfo->Idx) == nType)
                                {
                                    n01++;
                                    byte[] data = new byte[sizeof(TShopInfo)];
                                    fixed (byte* pb = data)
                                    {
                                        *(TShopInfo*)pb = *ShopInfo;
                                    }
                                    sSendStr = sSendStr + EncryptUnit.EncodeBuffer(data, sizeof(TShopInfo)) + "/";
                                    if (n01 >= 10)
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    if (sSendStr != "")
                    {
                        this.SendMsg(this, Grobal2.RM_OPENSHOP, 0, nPageCount, nPage + 1, n01, sSendStr);// 齐珍类型
                    }
                    if (M2Share.g_ShopItemList.Count > 0)
                    {
                        for (int I = 0; I < M2Share.g_ShopItemList.Count; I++)
                        {
                            pShopInfo = ((TShopInfo*)(M2Share.g_ShopItemList[I]));
                            ShopInfo = pShopInfo;
                            if (Convert.ToInt32(ShopInfo->Idx) == 5)
                            {
                                n02++;
                                byte[] data = new byte[sizeof(TShopInfo)];
                                fixed (byte* pb = data)
                                {
                                    *(TShopInfo*)pb = *ShopInfo;
                                }
                                sSendStr1 = sSendStr1 + EncryptUnit.EncodeBuffer(data, sizeof(TShopInfo)) + "/";
                                if (n02 >= 5)
                                {
                                    break;
                                }
                            }
                        }
                    }
                    if (sSendStr1 != "")
                    {
                        this.SendMsg(this, Grobal2.RM_OPENSHOPSpecially, 0, nPageCount, nPage + 1, n02, sSendStr1);
                    }
                }
                catch
                {
                    M2Share.MainOutMessage("{异常} TPlayObject.ClientGetShopItemList");
                }
            }
            finally
            {
                m_boCanQueryShopItme = false;// 是否可以刷新商铺
            }
        }

        /// <summary>
        /// 客户端购买商铺物品
        /// </summary>
        /// <param name="sItemName"></param>
        private unsafe void ClientBuyShopItem(string sItemName)
        {
            TStdItem* StdItem;
            TUserItem* UserItem = null;
            int nPrice;
            int nCount;
            bool boBuyShopItem;
            if (m_boBuyShopItem) // 正在购买商铺物品中
            {
                return;
            }
            m_boBuyShopItem = true;
            boBuyShopItem = false;
            try
            {
                try
                {
                    StdItem = UserEngine.GetShopStdItem(sItemName);
                    if (StdItem != null)
                    {
                        nPrice = StdItem->Price / 100;
                        nCount = StdItem->NeedLevel;// 一次可以购买的数量
                        if (nCount <= 0)
                        {
                            nCount = 1;// 防止死循环
                        }
                        if ((m_nGameGold >= nPrice) && (nPrice >= 0) && (nCount > 0))
                        {
                            for (int I = 0; I < nCount; I++)
                            {
                                if (this.m_ItemList.Count >= Grobal2.MAXBAGITEM)
                                {
                                    break;
                                }
                                if (IsEnoughBag())
                                {
                                    UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                                    if (UserEngine.CopyToUserItemFromName(sItemName, UserItem))
                                    {
                                        if ((StdItem->StdMode == 60) && (StdItem->Shape != 0) && (StdItem->AniCount == 2))
                                        {
                                            if (UserItem->btValue[0] < 5)// 购买药酒时，品质低于5时，重新计算
                                            {
                                                UserItem->btValue[0] = Convert.ToByte(HUtil32.Random(3) + 5);
                                            }
                                        }
                                        if (this.AddItemToBag(UserItem))
                                        {
                                            if (StdItem->NeedIdentify == 1)
                                            {
                                                M2Share.AddGameDataLog("30" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString() + "\09" + (this.m_nCurrY).ToString()
                                                    + "\09" + this.m_sCharName + "\09" + HUtil32.SBytePtrToString(StdItem->Name, 0, StdItem->NameLen) + "\09" + (UserItem->MakeIndex).ToString() + "\09" + "(" + (HUtil32.LoWord(StdItem->DC)).ToString()
                                                    + "/" + (HUtil32.HiWord(StdItem->DC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MC)).ToString() + "/" + (HUtil32.HiWord(StdItem->MC)).ToString()
                                                    + ")" + "(" + (HUtil32.LoWord(StdItem->SC)).ToString() + "/" + (HUtil32.HiWord(StdItem->SC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->AC)).ToString()
                                                    + "/" + (HUtil32.HiWord(StdItem->AC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MAC)).ToString() + "/" + (HUtil32.HiWord(StdItem->MAC)).ToString() + ")"
                                                    + (UserItem->btValue[0]).ToString() + "/" + (UserItem->btValue[1]).ToString() + "/" + (UserItem->btValue[2]).ToString() + "/" + (UserItem->btValue[3]).ToString()
                                                    + "/" + (UserItem->btValue[4]).ToString() + "/" + (UserItem->btValue[5]).ToString() + "/" + (UserItem->btValue[6]).ToString() + "/" + (UserItem->btValue[7]).ToString()
                                                    + "/" + (UserItem->btValue[8]).ToString() + "/" + (UserItem->btValue[14]).ToString() + "\09" + (UserItem->Dura).ToString() + "/" + (UserItem->DuraMax).ToString());
                                            }
                                            SendAddItem(UserItem);
                                            boBuyShopItem = true;
                                            this.SysMsg("[成功] " + sItemName + " 购买成功！", TMsgColor.c_Blue, TMsgType.t_Hint);
                                        }
                                    }
                                    else
                                    {
                                        Marshal.FreeHGlobal((IntPtr)UserItem);
                                    }
                                }
                                else
                                {
                                    this.SendMsg(this, Grobal2.RM_BUYSHOPITEM_FAIL, 0, 2, 0, 0, sItemName);// 包裹满
                                    break;
                                }
                            }
                        }
                        else
                        {
                            this.SendMsg(this, Grobal2.RM_BUYSHOPITEM_FAIL, 0, 1, 0, 0, sItemName);
                        }
                        if (boBuyShopItem)// 购买成功
                        {
                            DecGameGold(nPrice);
                            this.GameGoldChanged();
                            m_BuyShopPrice = nPrice;// 每次商铺花的元宝数量，$BuyShop变量使用
                            if (M2Share.g_FunctionNPC != null)// 商铺购买触发
                            {
                                M2Share.g_FunctionNPC.GotoLable(this, "@BuyShop", false);
                            }
                        }
                    }
                    else
                    {
                        this.SendMsg(this, Grobal2.RM_BUYSHOPITEM_FAIL, 0, 3, 0, 0, sItemName);
                    }
                }
                catch
                {
                    M2Share.MainOutMessage("{异常} TPlayObject.ClientBuyShopItem");
                }
            }
            finally
            {
                m_boBuyShopItem = false;
            }
        }

        /// <summary>
        /// 客户端商铺赠送
        /// </summary>
        /// <param name="sMsg"></param>
        private unsafe void ClientBuyShopItemGive(string sMsg)
        {
            string GiveUseName = null;
            string GiveItemName = null;
            string GiveMyName = null;
            TStdItem* StdItem = null;
            TUserItem* UserItem = null;
            int nPrice;
            int nCount;
            TPlayObject PlayObjectGive;
            bool boBuyShopItem;
            if (m_boBuyShopItem)// 正在购买商铺物品中
            {
                return;
            }
            m_boBuyShopItem = true;
            boBuyShopItem = false;
            try
            {
                try
                {
                    sMsg = HUtil32.GetValidStr3(sMsg, ref GiveItemName, new string[] { "/" });
                    sMsg = HUtil32.GetValidStr3(sMsg, ref GiveUseName, new string[] { "/" });
                    sMsg = HUtil32.GetValidStr3(sMsg, ref GiveMyName, new string[] { "/" });
                    GiveUseName = EncryptUnit.DeCodeString(GiveUseName);
                    GiveItemName = EncryptUnit.DeCodeString(GiveItemName);
                    GiveMyName = EncryptUnit.DeCodeString(GiveMyName);
                    StdItem = UserEngine.GetShopStdItem(GiveItemName);
                    if (StdItem != null)
                    {
                        PlayObjectGive = UserEngine.GetPlayObject(GiveUseName);
                        if (PlayObjectGive == null) // 角色没在线
                        {
                            this.SendMsg(this, Grobal2.RM_BUYSHOPITEMGIVE_FAIL, 0, 4, 0, 0, GiveUseName);// 赠送的人没在线
                            return;
                        }
                        nPrice = StdItem->Price / 100;
                        nCount = StdItem->NeedLevel;// 一次可以购买的数量 20090114
                        if (nCount <= 0)
                        {
                            nCount = 1; // 防止死循环
                        }
                        if ((m_nGameGold >= nPrice) && (nPrice >= 0) && (nCount > 0))
                        {
                            for (int I = 0; I < nCount; I++)
                            {
                                if (PlayObjectGive.m_ItemList.Count >= Grobal2.MAXBAGITEM)
                                {
                                    break;
                                }
                                if (PlayObjectGive.IsEnoughBag()) // 人物背包
                                {
                                    UserItem = (TUserItem*)Marshal.AllocHGlobal(sizeof(TUserItem));
                                    if (UserEngine.CopyToUserItemFromName(GiveItemName, UserItem))
                                    {
                                        if (PlayObjectGive.AddItemToBag(UserItem))
                                        {
                                            if (StdItem->NeedIdentify == 1)// 攻 魔法 道术 防御 魔御
                                            {
                                                M2Share.AddGameDataLog("30" + "\09" + this.m_sMapName + "\09" + (this.m_nCurrX).ToString() + "\09" +
                                                    (this.m_nCurrY).ToString() + "\09" + PlayObjectGive.m_sCharName + "\09" + HUtil32.SBytePtrToString(StdItem->Name, 0, StdItem->NameLen) + "\09" +
                                                    (UserItem->MakeIndex).ToString() + "\09" + "(" + (HUtil32.LoWord(StdItem->DC)).ToString() + "/" +
                                                    (HUtil32.HiWord(StdItem->DC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MC)).ToString() + "/" + (HUtil32.HiWord(StdItem->MC)).ToString()
                                                    + ")" + "(" + (HUtil32.LoWord(StdItem->SC)).ToString() + "/" + (HUtil32.HiWord(StdItem->SC)).ToString() + ")" + "(" +
                                                    (HUtil32.LoWord(StdItem->AC)).ToString() + "/" + (HUtil32.HiWord(StdItem->AC)).ToString() + ")" + "(" + (HUtil32.LoWord(StdItem->MAC)).ToString()
                                                    + "/" + (HUtil32.HiWord(StdItem->MAC)).ToString() + ")" + (UserItem->btValue[0]).ToString() + "/" +
                                                    (UserItem->btValue[1]).ToString() + "/" + (UserItem->btValue[2]).ToString() + "/" + (UserItem->btValue[3]).ToString()
                                                    + "/" + (UserItem->btValue[4]).ToString() + "/" + (UserItem->btValue[5]).ToString() + "/" +
                                                    (UserItem->btValue[6]).ToString() + "/" + (UserItem->btValue[7]).ToString() + "/" + (UserItem->btValue[8]).ToString()
                                                    + "/" + (UserItem->btValue[14]).ToString() + "\09" + this.m_sCharName + "(赠)");
                                            }
                                            PlayObjectGive.SendAddItem(UserItem);
                                            boBuyShopItem = true;
                                            this.SendMsg(this, Grobal2.RM_BUYSHOPITEMGIVE_SUCCESS, 0, 1, 0, 0, "[成功]赠送给 " + GiveItemName + " 物品 " + GiveUseName + " 成功！");
                                            PlayObjectGive.SysMsg("[提示]你的朋友 " + GiveMyName + " 在商铺里给你买了 " + GiveItemName + " 请您查收！", TMsgColor.c_Blue, TMsgType.t_Hint);
                                        }
                                    }
                                    else
                                    {
                                        Marshal.FreeHGlobal((IntPtr)UserItem);
                                    }
                                }
                                else
                                {
                                    this.SendMsg(this, Grobal2.RM_BUYSHOPITEMGIVE_FAIL, 0, 3, 0, 0, GiveItemName);// 背包满
                                    break;
                                }
                            }
                        }
                        else
                        {
                            this.SendMsg(this, Grobal2.RM_BUYSHOPITEMGIVE_FAIL, 0, 1, 0, 0, GiveItemName); // 元宝不够
                        }
                        if (boBuyShopItem)// 购买成功
                        {
                            DecGameGold(nPrice);
                            this.GameGoldChanged();
                            m_BuyShopPrice = nPrice;// 每次商铺花的元宝数量，$BuyShop变量使用
                            if (M2Share.g_FunctionNPC != null)
                            {
                                M2Share.g_FunctionNPC.GotoLable(this, "@BuyShop", false);// 商铺购买触发
                            }
                        }
                    }
                    else
                    {
                        // 没有找到这个物品
                        this.SendMsg(this, Grobal2.RM_BUYSHOPITEMGIVE_FAIL, 0, 2, 0, 0, GiveItemName);
                    }
                }
                catch
                {
                    M2Share.MainOutMessage("{异常} TPlayObject.ClientBuyShopItemGive");
                }
            }
            finally
            {
                m_boBuyShopItem = false;
            }
        }

        /// <summary>
        /// 客户端商铺兑换灵符
        /// </summary>
        /// <param name="nGameGird"></param>
        private void ClientExchangeGameGird(int nGameGird)
        {
            try
            {
                if (!GameConfig.g_boGameGird)
                {
                    this.SendMsg(this, Grobal2.RM_EXCHANGEGAMEGIRD_FAIL, 0, 0, 0, 0, "[失败]对不起，本服务没有开放");
                    return;
                }
                if (m_nGameGold <= 0)
                {
                    this.SendMsg(this, Grobal2.RM_EXCHANGEGAMEGIRD_FAIL, 0, 0, 0, 0, "[失败]您的" + GameConfig.sGameGoldName + "不够，请冲值！ 本服"
                        + (GameConfig.g_nGameGold).ToString() + "个" + GameConfig.sGameGoldName + "兑换1个灵符！");
                    return;
                }
                if (m_nGameGold >= nGameGird * GameConfig.g_nGameGold)// 当前元宝>兑换数量*每个灵符单价
                {
                    DecGameGold(nGameGird * GameConfig.g_nGameGold);// 给角色减元宝
                    IncGameGird(nGameGird);
                    this.GameGoldChanged();
                    this.SendMsg(this, Grobal2.RM_EXCHANGEGAMEGIRD_SUCCESS, 0, 0, 0, 0, "[成功]您成功的兑换了 " + (nGameGird).ToString() + " 个灵符");
                }
                else
                {
                    this.SendMsg(this, Grobal2.RM_EXCHANGEGAMEGIRD_FAIL, 0, 0, 0, 0, "[失败]您的" + GameConfig.sGameGoldName + "不够，请冲值！ 本服"
                        + (GameConfig.g_nGameGold).ToString() + "个" + GameConfig.sGameGoldName + "兑换1个灵符！");// 元宝不足
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.ClientExchangeGameGird");
            }
        }

        /// <summary>
        /// 清理包裹和仓库复制物品
        /// </summary>
        /// <param name="nCode"></param>
        /// <param name="wIndex"></param>
        /// <param name="MakeIndex"></param>
        public unsafe void ClearCopyItem(byte nCode, int wIndex, int MakeIndex)
        {
            TUserItem* UserItem;
            try
            {
                this.m_boOperationItemList = true;  // 防止同时操作背包列表时保存
                switch (nCode)
                {
                    case 0:// 检查背包中是否有复制品
                        for (int I = this.m_ItemList.Count - 1; I >= 0; I--)
                        {
                            if (this.m_ItemList.Count <= 0)
                            {
                                break;
                            }
                            UserItem = (TUserItem*)this.m_ItemList[I];
                            if ((UserItem->wIndex == wIndex) && (UserItem->MakeIndex == MakeIndex))
                            {
                                SendDelItems(UserItem);
                                M2Share.MainOutMessage("[清理包裹复制品](" + this.m_sCharName + ")" + UserEngine.GetStdItemName(UserItem->wIndex)
                                    + "(" + (UserItem->MakeIndex).ToString() + ")[" + (UserItem->btValue[0]).ToString() + "/" + (UserItem->btValue[1]).ToString()
                                    + "/" + (UserItem->btValue[2]).ToString() + "/" + (UserItem->btValue[3]).ToString() + "/" + (UserItem->btValue[4]).ToString()
                                    + "/" + (UserItem->btValue[5]).ToString() + "/" + (UserItem->btValue[6]).ToString() + "/" + (UserItem->btValue[7]).ToString()
                                    + "/" + (UserItem->btValue[8]).ToString() + "/" + (UserItem->btValue[14]).ToString() + "/#" + (UserItem->btValue[15]).ToString()
                                    + "/" + (UserItem->btValue[16]).ToString() + "/" + (UserItem->btValue[17]).ToString() + "/" + (UserItem->btValue[18]).ToString()
                                    + "/" + (UserItem->btValue[19]).ToString());
                                this.m_ItemList.RemoveAt(I);
                                break;// 只找到一件则退出，提高效率
                            }
                        }
                        break;
                    case 1:
                        for (int I = m_StorageItemList.Count - 1; I >= 0; I--)
                        {
                            if (m_StorageItemList.Count <= 0)
                            {
                                break;
                            }
                            UserItem = (TUserItem*)m_StorageItemList[I];
                            if ((UserItem->wIndex == wIndex) && (UserItem->MakeIndex == MakeIndex))
                            {
                                M2Share.MainOutMessage("[清理仓库复制品](" + this.m_sCharName + ")" + UserEngine.GetStdItemName(UserItem->wIndex) + "("
                                    + (UserItem->MakeIndex).ToString() + ")[" + (UserItem->btValue[0]).ToString() + "/" + (UserItem->btValue[1]).ToString() + "/"
                                    + (UserItem->btValue[2]).ToString() + "/" + (UserItem->btValue[3]).ToString() + "/" + (UserItem->btValue[4]).ToString() + "/"
                                    + (UserItem->btValue[5]).ToString() + "/" + (UserItem->btValue[6]).ToString() + "/" + (UserItem->btValue[7]).ToString() + "/"
                                    + (UserItem->btValue[8]).ToString() + "/" + (UserItem->btValue[14]).ToString() + "/#" + (UserItem->btValue[15]).ToString() + "/"
                                    + (UserItem->btValue[16]).ToString() + "/" + (UserItem->btValue[17]).ToString() + "/" + (UserItem->btValue[18]).ToString() + "/"
                                    + (UserItem->btValue[19]).ToString());
                                m_StorageItemList.RemoveAt(I);
                                break;  // 找到一件则退出，提高效率
                            }
                        }
                        break;
                }
                this.m_boOperationItemList = false;// 防止同时操作背包列表时保存
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TPlayObject.ClearCopyItem");
                this.m_boOperationItemList = false;// 防止同时操作背包列表时保存
            }
        }

        // 检查人物装备死亡物品是否爆
        public unsafe bool CheckItemBindDieNoDrop(TUserItem* UserItem)
        {
            bool result = false;
            TItemBind ItemBind;
            HUtil32.EnterCriticalSection(M2Share.g_ItemBindDieNoDropName);
            try
            {
                if (M2Share.g_ItemBindDieNoDropName.Count > 0)
                {
                    for (int I = 0; I < M2Share.g_ItemBindDieNoDropName.Count; I++)
                    {
                        //ItemBind = M2Share.g_ItemBindDieNoDropName[I];
                        //if (ItemBind != null)
                        //{
                        //    if (ItemBind.nItemIdx == UserItem->wIndex)
                        //    {
                        //        if (((ItemBind.sBindName).ToLower().CompareTo((this.m_sCharName).ToLower()) == 0))
                        //        {
                        //            result = true;
                        //        }
                        //        return result;
                        //    }
                        //}
                    }
                }
            }
            finally
            {
                HUtil32.LeaveCriticalSection(M2Share.g_ItemBindDieNoDropName);
            }
            return result;
        }

        /// <summary>
        /// 取天地结晶当前等级的经验，内功上限值 
        /// </summary>
        /// <param name="nLevel"></param>
        /// <param name="nMaxExp">当前经验上限</param>
        /// <param name="nMaxNGExp"></param>
        /// <returns>内功经验上限</returns>
        private bool GetExpCrystal(byte nLevel, ref uint nMaxExp, ref uint nMaxNGExp)
        {
            bool result = true;
            if (nLevel < 5)
            {
                nMaxExp = 0;
                nMaxNGExp = 0;
                nMaxExp = GameConfig.dwNGExpCrystalNeedExps[nLevel];
                nMaxNGExp = GameConfig.dwExpCrystalNeedExps[nLevel];
            }
            return result;
        }

        /// <summary>
        /// 客户端点击天地结晶，返回经验等信息
        /// </summary>
        private void ClientGetExpCrystalData()
        {
            if (m_boShowExpCrystal && m_boGetExpCrystalExp) // 天地结晶图标为显示，并且可以提取经验时
            {
                if ((m_nGetCrystalExp > 0) && (m_nGetCrystalNGExp > 0) && (m_CrystalLevel < 6) && (m_CrystalLevel > 0))
                {
                    if (M2Share.g_FunctionNPC != null)
                    {
                        M2Share.g_FunctionNPC.GotoLable(this, "@GetCrystalData", false);// 返回经验等信息触发
                    }
                }
            }
        }

        /// <summary>
        /// 客户端提取天地结晶经验
        /// </summary>
        public void ClientGetExpTCrystal()
        {
            if (m_boShowExpCrystal && m_boGetExpCrystalExp)// 天地结晶图标为显示，并且可以提取经验时
            {
                if ((m_nGetCrystalExp > 0) && (m_nGetCrystalNGExp > 0) && (m_CrystalLevel < 6) && (m_CrystalLevel > 0)) // 人物获得经验
                {
                    GetNGExp(m_nGetCrystalNGExp, 3);// 取天地结晶内功经验
                    GetExp(m_nGetCrystalExp, false, 3);// 取天地结晶经验
                    m_CrystalNGExp = m_CrystalNGExp - m_nGetCrystalNGExp; // 取得经验后的处理
                    m_CrystalExp = m_CrystalExp - m_nGetCrystalExp;
                    m_CrystalLevel = 1;
                    m_nGetCrystalNGExp = 0;
                    m_nGetCrystalExp = 0;
                    m_boGetExpCrystalExp = false;
                    GetExpCrystal(m_CrystalLevel, ref m_CrystalMaxExp, ref m_CrystalNGMaxExp);// 取天地结晶当前等级经验上限
                    SendDefMessage(Grobal2.SM_SENDCRYSTALLEVEL, m_CrystalLevel, 0, 0, 0, "");
                    SendDefMessage(Grobal2.SM_SENDCRYSTALNGEXP, 0, 0, 0, 0, (m_CrystalNGExp).ToString() + "/"
                        + (m_CrystalMaxExp).ToString() + "/" + (m_CrystalNGMaxExp).ToString());// 发送天地结晶内功经验
                    SendDefMessage(Grobal2.SM_SENDCRYSTALEXP, 0, 0, 0, 0, (m_CrystalExp).ToString() + "/"
                        + (m_CrystalMaxExp).ToString() + "/" + (m_CrystalNGMaxExp).ToString());// 发送天地结晶内功经验
                }
            }
        }
    }
}